I need to get this field:
But I am struggling with my code:
private void getContactList() {
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
if ((cur != null ? cur.getCount() : 0) > 0) {
while (cur != null && cur.moveToNext()) {
Contact contact = new Contact();
String id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
String name = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
String photoURI = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.PHOTO_URI));
String photoThumbURI = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.PHOTO_THUMBNAIL_URI));
//Phones
Cursor pCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?",
new String[]{id}, null);
while (pCur.moveToNext()) {
String phoneNum = pCur.getString(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
int phoneType = pCur.getInt(pCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.TYPE));
}
///Emails
Cursor pCur2 = cr.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?",
new String[]{id}, null);
while (pCur2.moveToNext())
{
String em = pCur2.getString(pCur2.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
Log.d("DTAG","em: "+em);
}
///Sip
Cursor pCur3 = cr.query(/*What goes here?*/,
null,
ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?",
new String[]{id}, null);
while (pCur3.moveToNext())
{
String em = pCur3.getString(pCur3.getColumnIndex(ContactsContract.CommonDataKinds.SipAddress.DATA));
}
contact.setId(id);
contact.setName(name);
contact.setImageURI(photoURI);
contact.setThumbnailURI(photoThumbURI);
pCur.close();
}
}
if (cur != null) {
cur.close();
}
}
How to address the SIP query to find this number?