Hi,

1) You should call the contact picker using startActivityForResult
2) You should override onActivityResult and parse the data returned from the contact picker.
Something like:
    ...
    Uri result = data.getData();
    String id = result.getLastPathSegment();

    Cursor cursor = getContentResolver().query(Phone.CONTENT_URI, null,
                    Email.CONTACT_ID + "=?", new String [] { id }, null);
    int numberIdx = cursor.getColumnIndex(Phone.DATA);
    if (cursor.moveToFirst()) {
                String number = cursor.getString(numberIdx);
                yourEditText.setText(number);
   }

Don't forget to verify that the activityResult are returned from the contact picker and the result code is ok.

Hope this helps
/Yaron


On 01/24/2012 11:31 AM, Bharath kumar Thota wrote:
Hi, I am a newbie to android and while developing i got stuck up at a
point and there by i could not move further.Please some one help me to
solve my problem.

My problem is as follows.. I wanna get the phone number of a
particular contact into the edit text i.e., When i select a contact
from the contacts, the phone number of the selected contact should get
displayed in the EditText box..I had gone to the extent of opening the
contacts, and now i can't find the way to pick the number and then get
it in to the edittext.


Thank you,
Bharath


--
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