Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/190.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何检测联系人的默认电话号码(如果已设置)_Android_Android Contacts - Fatal编程技术网

Android 如何检测联系人的默认电话号码(如果已设置)

Android 如何检测联系人的默认电话号码(如果已设置),android,android-contacts,Android,Android Contacts,自动取款机我得到一个给定联系人ID的号码和标签 String where = ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId; Cursor c = ctx.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, where, null, null); while (c.moveToNext

自动取款机我得到一个给定联系人ID的号码和标签

String where =  ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId;
Cursor c = ctx.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, where, null, null);
while (c.moveToNext()) {
     String number = Tools.getString(c, CommonDataKinds.Phone.NUMBER);
     String label = Tools.getString(c,CommonDataKinds.Phone.LABEL);
}

Android能够将给定的数字标记为“默认数字”如何确定查询的号码是否为默认号码?

尝试在内容URI查询中查询该列

如果返回非零值,则该条目可能被解释为其类型的默认联系人值(例如,用于联系人的默认电话号码)


更多信息:

非常感谢。我找了些时间找这个。我想知道为什么这里的文档如此不精确。但是当SUPER_PRIMARY>0时,将一个数字标记为默认数字似乎可以正常工作!:-)