// Jump to the contact page
Private void pickContact (){
// Create an intent to "pick" a contact, as defined by the content provider URI
Intent intent = new Intent (Intent. ACTION_PICK, Contacts. CONTENT_URI );
StartActivityForResult (intent, PICK_CONTACT_REQUEST );
}
// The data in the returned Intent is The Uri of the selected contact, indicating The resource location, so that the ContentProvider can query The resource (the URI, using The content: // scheme, for the content to retrieve)
@ Override
Protected void onActivityResult (int requestCode, int resultCode, Intent data ){
If (resultCode = Activity. RESULT_ OK & requestCode = PICK_CONTACT_REQUEST ){
System. out. println ("data. getData ()" + data. getData ());
// The output is content: // com. android. contacts/lookup/0r5-20.c3a525c/5.
Cursor cursor = getContentResolver (). query (data. getData (), new String [] {Contacts. DISPLAY_NAME}, null );
If (cursor. moveToFirst ()){
Int columnIndex = cursor. getColumnIndex (Contacts. DISPLAY_NAME );
String name = cursor. getString (columnIndex );
System. out. println (name );
}
}
}