Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a contact card in Android by ID

Is it possible to open an android contact card by contact's ID? It works with the phone-number. Here is an example, if I use

Intent i = new Intent();
i.setAction(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT);
i.setData(Uri.fromParts("tel", "123456", null)); //<---- Change here from Phone to IDcontext.startActivity(i);

But I want to open this contact card by ID, for example if the phone-number from the contact would change.

like image 655
Java_Waldi Avatar asked Nov 25 '10 08:11

Java_Waldi


People also ask

How do I open Android contact list?

On your Android phone or tablet, open the Contacts app . Tap a Contact in the list. Select an Option.

How do I share my contact card on Android?

For Android: Open your contact card in the Contacts app (or launch the Phone app and tap the Contacts app near the right side of the screen), then tap the three-dot menu button in the top-right corner of the screen. Tap Share, then pick your messaging application of choice.

How do I select and display my phone number from a contact list on Android?

Open your Contacts app and tap the Options button (three dots), and select Contacts Manager. On the next screen, tap on Contacts to display from the menu. Next, if you only want contacts with a phone number, tap on Phone.

What is a contact card?

Lync 2013 for Android. The contact card displays information about people and provides several ways to communicate with someone. For example, you can send an instant message, start an audio or video call, or send an email message directly from someone's contact card.


1 Answers

use ACTION_VIEW and either build a contact URI using the contact ID or use the contact lookup URI if you already have it (preferred).

    Intent intent = new Intent(Intent.ACTION_VIEW);
    Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(contactID));
    intent.setData(uri);
context.startActivity(intent);
like image 197
Thorstenvv Avatar answered Nov 16 '22 03:11

Thorstenvv