How to retrieve Contact name and phone number in Android

后端 未结 6 1260
旧时难觅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:46

    HellBoy is right, Phone.xxx is depricated. I did it that way with a lookup-uri:

    Uri look = Uri.withAppendedPath(Contacts.CONTENT_LOOKUP_URI, "23N9983726428fnwe");
    Intent i = new Intent(Intent.ACTION_VIEW); 
    i.setData(look);
    

    Experiment with Contacts.xxx on the first line, you will find the right sollution.

提交回复
热议问题