How to call Android contacts list?

前端 未结 13 2346
傲寒
傲寒 2020-11-22 02:50

I\'m making an Android app, and need to call the phone\'s contact list. I need to call the contacts list function, pick a contact, then return to my app with the contact\'s

13条回答
  •  半阙折子戏
    2020-11-22 03:29

    Looking around for an API Level 5 solution using ContactsContract API you could slightly modify the code above with the following:

      Intent intent = new Intent(Intent.ACTION_PICK);
      intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
      startActivityForResult(intent, PICK_CONTACT);
    

    And then in onActivityResult use the column name:

      ContactsContract.Contacts.DISPLAY_NAME
    

提交回复
热议问题