I'm designing an app which requires opening the contacts app with a search. I'm using the code:
Intent intent = new Intent(Intent.ACTION_SEARCH);
intent.putExtra(SearchManager.QUERY, name);
startActivity(intent);
The problem I have is that this opens the app chooser and displays about 40 apps for the user to choose from, which could be confusing. Is there any way to automatically set the contacts app as default or even to minimise the list?
I have tried using the command:
intent.setData(ContactsContract.Contacts.CONTENT_URI);
This seems to work for other types of contact related activities such as ACTION_VIEW, but when I add it to an ACTION_SEARCH intent the app simply crashes.
Thank you.