Phonebook settings (e.g. contact filter)

I want to hide all contacts without phone numbers in the phone book from my application. As in the phone book, when you go to the phone book settings →, there is a flag that says "Contacts only with phone number" I want to implement this function in my application

I need a method (code) for navigating phonebook users → settings (activity) (system application)

from my app activity.

or worst case, hide all contacts without a phone number through the database. So the phone book can be filtered out.

I have currently found

Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, 123);

The phone book opens above the code, but I want to open the phone book page → settings page.

In general, I want to make the contents of the phone book "contacts with phone numbers" from my application

+5
source share
3 answers

I need a method (code) to navigate the phonebook → settings (activity) (system application)

There are hundreds, perhaps thousands, of Android phones. None of them will necessarily be the same with the "phonebook" application. None of these phone book applications necessarily have the feature you are looking for - some may, some many not. And, most likely, none of them has a documented and supported structure Intentfor accessing the screen in the application to control the setting that they may or may not have.

, .

"phonebook", , READ_CONTACTS ContactsContract ContentProvider.

+3
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, PICK_CONTACT);
+2

Well, I have successfully developed the Contacts application for Android as my main project. I find it pretty simple. Here is the code how I did it.

Cursor c = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
                                           null,
                                           ContactsContract.Contacts.HAS_PHONE_NUMBER + " = 1", 
                                           null, 
                                           ContactsContract.Contacts.DISPLAY_NAME+" COLLATE LOCALIZED ASC");

            mAdapter = new MyAdapter(this,
                       R.layout.single_cell,
                       c, 
                       new String[]{ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME},
                       new int[]{R.id.disp_name},
                       CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);

            listview.setAdapter(mAdapter);

And, in MyAdapter, I expanded SimpleCursorAdapter and moved bindView () to take advantage of the effectiveness of SimpleCursorAdapter. However, you need to get permission to read contacts. In the manifest file. Please, indicate,

<uses-permission android:name="android.permission.READ_CONTACTS"/>

Hope this helps.

0
source

All Articles