Ok, i am able to start the Contacts application...and I pick a contact from
there. Now this operation succeeds too (-1 Result Code).

I use the following code:

Intent i = new Intent(Intent.ACTION_PICK,
ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(i, PICK_CONTACT);

I get a callback in the onActivityResult method which provides me with the
data as an Intent as shown below:

 @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent
data)
    {
     super.onActivityResult(requestCode, resultCode, data);

     if(resultCode==RESULT_OK)
     System.out.println("a contact was picked..");
     Uri uri = data.getData();

     System.out.println(uri);

    }
I want to access the details of the contact that was picked (Display name,
phone numbers etc) .

I get a URI from the data received from the Contacts application. What does
this URI point to ? Will i need to execute a DB query to get the actual user
data for the contact ?

Kindly guide..

Help is appreciated.

Thanks in advance

Indodroid.


On Fri, Jan 29, 2010 at 9:15 AM, Android Development <[email protected]>wrote:

> Hello,
>
> I wish to re-use the Contacts application in a way to enable the user to
> pick a contact and return it to the parent activity (my application's
> activity).
>
> For achieving this, I want to inquire about the kind of Intent that will be
> needed to launch the contacts application.
>
> Intent i = new Intent(Intent.ACTION_GET_CONTENT, ???);
> startActivityForResult(.....);
>
> What should be the second argument here ?
>
> In the deprecated Contacts API, I could use the following snippet, but not
> sure about ContactsContract:
>
> Intent i= new Intent(Intent.ACTION_GET_CONTENT,People.CONTENT_URI);
> startActivityForResult(i, reqCode);
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to