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);
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.
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);
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.
I have copied contacts local phonebook and have shown them in my custom list. While copying the contact list i have maintained each contact and his detail in an array.
Now I want to open up the default details screen when i click on any contact in my list. Please tell me how is this possible.
Looking at the Intent.ACTION_VIEW Pass this action with a valid URI.
For anyone whos looking for specifics:
Intent contViewIntent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI,phn_user.getId());
Where getId return Id in String.
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);