0

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);
Jared Burrows
  • 52,770
  • 23
  • 148
  • 184
sai
  • 2,582
  • 7
  • 30
  • 45

1 Answers1

4

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

Community
  • 1
  • 1
Jared Burrows
  • 52,770
  • 23
  • 148
  • 184