I see in a app a contactpicker Intent that show for a contact that have multiple phone number like this:
--------------------
Friend 1
Mobile 555567777777
--------------------
Friend 2
Mobile 555567777777
Work cc555567777777
Home 44564646
--------------------
I can't find a way to do this only to retrieve one contact and query phone numbers after.
How I can call the intent to do in this way?
You could do something like this:
Intent intent = new Intent();
intent.setClassName("com.android.contacts","com.android.contacts.activities.PeopleActivity");
startActivity(intent);
Related
I can pick multi contact data via
Intent phonebookIntent = new Intent("intent.action.INTERACTION_TOPMENU");
phonebookIntent.putExtra("additional", "phone-multi");
phonebookIntent.putExtra("maxRecipientCount", MAX_PICK_CONTACT);
phonebookIntent.putExtra("FromMMS", true);
startActivityForResult(phonebookIntent, REQUEST_CODE_PICK_CONTACT);
but when I want to add another contact to present data , the selected contact data disappears.Is there an intent filter like "selectedList" by which I can send id list to contact picker intent
That could be impossible to do using implicit intent. You can always create your own activity, get the contacts using ContentProvider, pass the parameters you want and handle the logic there.
Intent myIntent = new Intent(Intent.ACTION_DIAL);
myIntent.setData(Uri.parse("tel:" +CallNumber));
startActivity(myIntent);
Is there any possibilities to show the contact name instead of the phone numbers on selecting menuitem call?
Maybe this link on stackoverflow can help:
Get Contact by Phone number on Android
First use it to retrieve the contact name based on the phone number. Then use:
myIntent.setData(Uri.parse("content://contacts/people/"+PersonName))
to call the person.
In my application i want to add the contact number . So here i called the Below code . It call the Add contact screen but i want to set the contact number using code . can any one help me to solve my problem ?
Intent intent = new Intent(Intent.ACTION_INSERT,People.CONTENT_URI);
startActivityForResult(intent, 1);
It is called Add Contact Screen .
As far as I know INSERT creates an empty contact. Maybe you can create an entry and then call the action.EDIT pointing to he new contact
Here is the Solution.
Intent addContactIntent = new Intent(Contacts.Intents.Insert.ACTION, Contacts.People.CONTENT_URI);
addContactIntent.putExtra(Contacts.Intents.Insert.PHONE,"Phone Number");
startActivity(addContactIntent);
android allows me to launch an intent to create a new contact. i can put extras into the intent to pre-fill the new contact fields.
Intent intent = new Intent(Intent.ACTION_INSERT);
intent.setType(ContactsContract.Contacts.CONTENT_TYPE);
intent.putExtra(ContactsContract.Intents.Insert.NAME, "Foo Bar");
intent.putExtra(ContactsContract.Intents.Insert.PHONE, "(408) 555-1212");
intent.putExtra(ContactsContract.Intents.Insert.EMAIL, "foo.bar#foobar.com");
startActivityForResult(intent, INSERT_CONTACT_REQUEST);
this works, but i don't see how to handle multiple types of a given field, say phone number. in the intent, i can put extra a phone number, and i can put extra a phone number type, but how do i put extra an additional phone number, with a different (or perhaps even the same) type?
ContactsContract.Intents.Insert allows for PHONE, SECONDARY_PHONE and TERTIARY_PHONE - the same applies for EMAIL and it suggests three of each might be the maximum.
I don't know if it's possible to have more than one phone of the same 'type' - my phones contacts editor removes 'Home' from the list of choices once I've assigned a home number for example. You can, however, assign your own 'custom' type. For example, suppose your friend has two home numbers...
intent.putExtra(ContactsContract.Intents.Insert.PHONE, "(123) 456-1212");
intent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, "HOME-1");
intent.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE, "(123) 456-2121");
intent.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, "HOME-2");
I need to update a contact name but i didn't way the way to do that with the old contact api (my application must work in 1.5,1.6 AND 2.X)
Ahan well do something like this
Intent i = new Intent(Intent.ACTION_EDIT);
i.setData(Uri.parse("content://com.android.contacts/raw_contacts/1));
//Here 1 is the id of the contact to edit. You can also generate it automatically.
startActivity(i);
If you mean at runtime you want to select id from an text box , you can do something like
Intent i = new Intent(Intent.ACTION_EDIT);
i.setData(Uri.parse("content://com.android.contacts/raw_contacts/" + textBox.getText() ));
//Here textBox should have any numerical value of the contact to edit.
startActivity(i);