Reputation: 2562
I am using intent to display contact list. From contacts I want to get contact information like firstname, secondname, emailid, phonenumber. I want all the information in onActivityForResult()
for selected contact.
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, 1);
Upvotes: 0
Views: 4239
Reputation: 55527
This has been answered many times, please check these posts out:
How to read contacts on Android 2.0
get contact info from android contact picker
How to call Android contacts list?
Google Android Developer Documentations:
@Override
public Loader<Cursor> onCreateLoader(int loaderId, Bundle args) {
/*
* Appends the search string to the base URI. Always
* encode search strings to ensure they're in proper
* format.
*/
Uri contentUri = Uri.withAppendedPath(Contacts.CONTENT_FILTER_URI, Uri.encode(mSearchString));
return new CursorLoader(
getActivity(),
contentUri,
PROJECTION,
null,
null,
null
);
}
Source: http://developer.android.com/training/contacts-provider/retrieve-names.html
Upvotes: 4