Static final int pick_contact_request = 1; // The request codeprivate void pickcontact () {URI contacts = Uri. parse ("content: // contacts"); intent pickcontactintent = new intent (intent. action_pick, contacts); pickcontactintent. settype (phone. content_type); // show user only contacts w/phone numbers startactivityforresult (pickcontactintent, pick_contact_request);} @ overrideprotected void onactivityresult (INT requestcode, int resultcode, intent data) {// check which request it is that we're re responding to If (requestcode = pick_contact_request) {// make sure the request was successful if (resultcode = result_ OK) {// get the URI that points to the selected contact URI contacturi = data. getdata (); // We only need the number column, because there will be only one row in the result string [] projection = {Phone. number, phone. contact_id}; // perform the query on the contact to get the number column // we don't need a selection or sort order (there's only one result for the given URI) // caution: the query () method shocould be called from a separate thread to avoid blocking // your app's UI thread. (For simplicity of the sample, this code doesn't do that .) // consider using cursorloader to perform the query. cursor cursor = getcontentresolver (). query (contacturi, projection, null); cursor. movetofirst (); // retrieve the phone number from the number column int column = cursor. getcolumnindex (phone. number); int column_id = cursor. getcolumnindex (phone. contact_id); string number = cursor. getstring (column); string id = cursor. getstring (column_id); edittext = (edittext) findviewbyid (R. id. edit_message); edittext. settext (number + id );}}}