How to retrieve Contact name and phone number in Android

后端 未结 6 1261
旧时难觅i
旧时难觅i 2020-12-10 05:56

I\'m trying to retrieve contact list with there name and phone numbers. I try following code:

 // Get a cursor over every contact.
    Cursor cursor = getCon         


        
6条回答
  •  情歌与酒
    2020-12-10 06:38

    Try the below code.

    Cursor managedCursor = getContentResolver()
    .query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
     new String[] {Phone._ID, Phone.DISPLAY_NAME, Phone.NUMBER}, null, null,  Phone.DISPLAY_NAME + " ASC");
    

提交回复
热议问题