How to open phonebook from android application? - android

I am working on android app in which I want to open phonebook on button click event. Will I have to use intent for that?
Thanks,
Vishakha.

Try something like this:
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT);
To get more into this see Android – Open Contacts Activity and Return Chosen Contact

Related

Reading gallery folders using Implicit intent

I am implementing an android app, which will synchronize images from selected folder to server (as Google Photo). I want that user will select folder by clicking on button. I can achieve this by creating my own view. But, if implicit intent can any implicit intent action by which I can show user only images folder from device?
Try,
Intent intent = new Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(intent, 100);
change EXTERNAL_CONTENT_URI constant accordingly.

Android open Contacts app (not choose a contact)

I want to give the user possibility to open Contacts app from my app, so he can edit them, export etc. What I DON'T WANT is a contact picker where the user selects a contact. I need only to somehow open the Contacts app from my app. How Can I do it ? Intent ?
The following snippet will do what you want .
Intent intent = new Intent(Intent.ACTION_VIEW, ContactsContract.Contacts.CONTENT_URI);
startActivity(intent);
This should work as expected.
Intent intent = new Intent();
intent.setComponent(new ComponentName(
"com.android.contacts"
,"com.android.contacts.DialtactsContactsEntryActivity");
startActivity(intent)

Set out filter for Action_Pick 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?

Open contact list to pick contact, or add a new one

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.

Option to create new contact from pick list

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.

Categories

Resources