No, It is Immpossible
Unfortunately, now he is not .
To prove this, let's dive into the source code of ContanctsListActivity .
Here is the onCreate() method of Activity . In it, ContactApp reads the Intent ( ACTION_PICK ), which we pass to it, and processes it accordingly:
@Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); mIconSize = getResources().getDimensionPixelSize(android.R.dimen.app_icon_size); mContactsPrefs = new ContactsPreferences(this); mPhotoLoader = new ContactPhotoLoader(this, R.drawable.ic_contact_list_picture); // Resolve the intent final Intent intent = getIntent(); // Allow the title to be set to a custom String using an extra on the intent String title = intent.getStringExtra(UI.TITLE_EXTRA_KEY); if (title != null) { setTitle(title); } String action = intent.getAction(); String component = intent.getComponent().getClassName(); // When we get a FILTER_CONTACTS_ACTION, it represents search in the context // of some other action. Let retrieve the original action to provide proper // context for the search queries. if (UI.FILTER_CONTACTS_ACTION.equals(action)) { mSearchMode = true; mShowSearchSnippets = true; Bundle extras = intent.getExtras(); if (extras != null) { mInitialFilter = extras.getString(UI.FILTER_TEXT_EXTRA_KEY); String originalAction = extras.getString(ContactsSearchManager.ORIGINAL_ACTION_EXTRA_KEY); if (originalAction != null) { action = originalAction; } String originalComponent = extras.getString(ContactsSearchManager.ORIGINAL_COMPONENT_EXTRA_KEY); if (originalComponent != null) { component = originalComponent; } } else { mInitialFilter = null; } } Log.i(TAG, "Called with action: " + action); mMode = MODE_UNKNOWN; if (UI.LIST_DEFAULT.equals(action) || UI.FILTER_CONTACTS_ACTION.equals(action)) { ..... else if (Intent.ACTION_PICK.equals(action)) { // XXX These should be showing the data from the URI given in // the Intent. final String type = intent.resolveType(this); if (Contacts.CONTENT_TYPE.equals(type)) { mMode = MODE_PICK_CONTACT; } else if (People.CONTENT_TYPE.equals(type)) { mMode = MODE_LEGACY_PICK_PERSON; } else if (Phone.CONTENT_TYPE.equals(type)) { mMode = MODE_PICK_PHONE; } else if (Phones.CONTENT_TYPE.equals(type)) { mMode = MODE_LEGACY_PICK_PHONE; } else if (StructuredPostal.CONTENT_TYPE.equals(type)) { mMode = MODE_PICK_POSTAL; } else if (ContactMethods.CONTENT_POSTAL_TYPE.equals(type)) { mMode = MODE_LEGACY_PICK_POSTAL; } .... // VERY LONG IF WITH DIFFERENT MODE-SELECTION .... } ..... if (mMode == MODE_JOIN_CONTACT) { setContentView(R.layout.contacts_list_content_join); } else if (mSearchMode) { setContentView(R.layout.contacts_search_content); } else if (mSearchResultsMode) { setContentView(R.layout.contacts_list_search_results); } else { setContentView(R.layout.contacts_list_content); } setupListView(); ... }
This is a very long method (and I also suggest checking the setupListView() method), but quite simple. And, as you see, there are no parameters that you can pass to indicate the source of the contacts you want to select from . The only thing you can configure here is the specific mMode ContactsApp to use ( MODE_PICK_CONTACT , MODE_PICK_PHONE , etc.) - but, unfortunately, the number of possible modes is very limited by 6, and they are not suitable.
(If someone needs to pass mMode to ContanctsListActivity - use the setType() method of washing, for example: intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE); )
Bypass
As a workaround - like the tiny sunlight suggested in the comments - draw the contacts without a SIM card in the application and select the one you need. How to get all contacts for Android, but without those on the SIM card - this link looks like the most promising one, explaining how to request a cursor with all contacts except for SIM files.
Hope this helps
source share