I use the code below to display contact numbers, but it is displaying names and numbers from the contact list.
public void getContacts(Context context){
context.startActivity(new Intent(Intent.ACTION_PICK, People.CONTENT_URI));
}
Like the above code how can I use the below code for getting only contact numbers from the contact list? I need to display only contact numbers without showing names. Please help with the right solution to solve this problem.
Uri personUri = ContentUris.withAppendedId(People.CONTENT_URI, personId);
Uri phonesUri = Uri.withAppendedPath(personUri, People.Phones.CONTENT_DIRECTORY);
String[] proj = new String[] {Phones._ID, Phones.TYPE, Phones.NUMBER, Phones.LABEL}
Cursor cursor = contentResolver.query(phonesUri, proj, null, null, null);
Try and look at this site:
Query contacts.
There are multiple methods for retrieving different content from contacts.
Hopefully that could help.