2

I know how to create an intent to let the contacts app display a specific contact:

Intent intent = new Intent(Intent.ACTION_VIEW);  
Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, mMyLookupKey);
intent.setData(uri);
startActivity(intent);

I also know how to create an intent to ask the contacts app to let me PICK a phone number:

Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI)
// Explicitly set the 'type' to 'phone numbers' //
intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE);    
startActivityForResult(intent, REQUEST_PHONENR);

Just now I have been trying to combine these to make it possible to pick a phone number from a specific contact:

Intent intent = new Intent(Intent.ACTION_PICK); 
Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_LOOKUP_URI, mMyLookupKey);
intent.setData(uri);
// Explicitly set the 'type' to 'phone numbers'
intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE);    
startActivityForResult(intent, REQUEST_PHONENR);

Does somebody know is this is possible?

Brabbeldas
  • 1,939
  • 4
  • 20
  • 32

1 Answers1

0
Intent pickContactIntent = new Intent(Intent.ACTION_PICK,ContactsContract.Contacts.CONTENT_URI);
                        pickContactIntent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE);
startActivityForResult(pickContactIntent, 0);
Abhijith
  • 37
  • 2
  • 8
  • Thnaks for trying abhijith. Could you maybe add some comments on why your code is different and why/ how it should work? – Brabbeldas Aug 17 '15 at 15:22