I can use this code to trigger a Contact Picker to show a list of contacts so that I can pick one of them.
Intent i=new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
startActivityForResult(i, PICK_REQUEST);
However, how can I send my request to show part of contacts, such as the name beginning by "A" only?
Related
I am able to make a call using,
Intent intent = new Intent(Intent.ACTION_CALL);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse("tel:" + "911"));
startActivity(intent);
But I am required to update emergency contact in Android programatically from my app. Is there any way to update emergency contact from any app other than from default contact app? By update I mean add, delete and modify any emergency contact.
Here is one post, where they discussed how to update contact, but in my case, I need to update the emergency contact not a normal contact.
There is no way to modify emergency information until now. However any app can ask user to edit info using ACTION_VIEW or ACTION_EDIT.
Intent intent = new Intent(Intent.ACTION_VIEW, ContactsContract.Profile.CONTENT_URI);
MainActivity.this.startActivity(intent);
I am using ACTION_PICK intent.
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, REQUEST_CONTACT);
However, I want to send a filter such that the list does not shows any contact number that does not have any name.
Similarly I want to filter out to show only those contacts that have got a number specific to a country code. For e.g. show only contacts that starts with 61.
Anything possible here?
I'd like to set up something to launch the built-in contact picker, and let a user choose an email, phone number, etc, then get said address/phone number back in my activity.
Am I correct in assuming that this isn't possible with android? It seems like you have to at least build a dialog yourself to choose in the case where a contact has multiple phone numbers/emails.
Even before that though, there doesn't seem to be a way to choose both phone numbers and emails simultaneously.
Is something like https://github.com/codinguser/android_contact_picker or rolling your own UI the only way to go?
Its perfectly possible and straight forward with android. You don't need to create any dialog box or anything for it. Just lauch the built in contact picker Activity via an Intent.
It you have to launch the intent from some event handler
Intent contactPickerIntent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
startActivityForResult(contactPickerIntent, CONTACT_PICKER_RESULT);
You should also have to implement
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
}
to receive URI of the contact user picked.
Thousands of tutorials are available on INTERNET on how to do it. Google is your friend.
Here is one http://mobile.tutsplus.com/tutorials/android/android-essentials-using-the-contact-picker/
In my application I need to pick a contact using the default contact application. I do that using:
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT);
But i'm missing the "Create New" button, which is there on the top. How can I get it?
You can't, this is not possible.
The only way is to create yourself the "ContactPickerActivity" so you can add what you want in it and for example your "Add a contact" button.
In your sample folder (samples/android-XX/ApiDemos/src/com/example/android/apis/app/LoaderCursor) you have a great exemple of how to achieve it.
My application wants a functionality of picking a contact from the
phone contact, I have achieved this using the following intent
Intent intent = new Intent(Intent.ACTION_PICK, People.CONTENT_URI);
startActivityForResult(intent, 001);
How do i start pick contact activity with an option to create a new contact from the pick list, similar to the one which is available in inbuilt Launcher appliation.
Perhaps passing in one of the extras listed in Contacts.Intents.UI. I'm mostly looking at LIST_ALL_CONTACTS_ACTION and LIST_DEFAULT.