how do i open contacts when i click a button defined in main.xml

前端 未结 3 1918
一向
一向 2020-12-15 12:30

I am developing a gps tracking app in android. I am done with displaying the map n stuff. Now I want to make a button on top which when clicked would display the contacts, T

3条回答
  •  春和景丽
    2020-12-15 13:06

    You should use startActivityForResult

    Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);  
    startActivityForResult(intent, 1); 
    

    See "get contact info from android contact picker" for more information.

提交回复
热议问题