当前位置: 动力学知识库 > 问答 > 编程问答 >

android - How to display numbers from contact list?

问题描述:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: