我正在使用此代码检索所有联系人姓名和电话号码:
String[] projection = new String[]
{
People.NAME,
People.NUMBER
};
Cursor c = ctx.getContentResolver().query(People.CONTENT_URI, projection, null, null, People.NAME + " ASC");
c.moveToFirst();
int nameCol = c.getColumnIndex(People.NAME);
int numCol = c.getColumnIndex(People.NUMBER);
int nContacts = c.getCount();
do
{
// Do something
} while(c.moveToNext());
Run Code Online (Sandbox Code Playgroud)
但是,这只会返回每个联系人的主号码,但我也想获得次要号码.我怎样才能做到这一点?
如何使用android SDK获取手机按键?我一直在寻找几个小时而没有找到任何东西..
例如:
在某些情况下,我想在用户按下电话上的"挂断"按钮时捕获消息,然后在消息到达操作系统之前丢弃该消息.
这可能吗?
关于C++中的内存处理,我有几个问题.
有什么不同Mystruct *s = new Mystruct
和Mystruct s
?记忆中会发生什么?
看看这段代码:
struct MyStruct{
int i;
float f;
};
MyStruct *create(){
MyStruct tmp;
tmp.i = 1337;
tmp.j = .5f;
return &tmp;
}
int main(){
MyStruct *s = create();
cout << s->i;
return 0;
}
Run Code Online (Sandbox Code Playgroud)什么时候免费MyStruct tmp
?为什么最后没有MyStruct tmp
自动免费create()
?
谢谢!
android ×2
c++ ×1
contacts ×1
free ×1
key ×1
keypress ×1
memory ×1
message ×1
new-operator ×1
phone-number ×1