-->

How to filter a contact picker intent on the basis

2020-07-22 19:41发布

问题:

On applying a picker (implicit) intent, we can show the contacts list, with all the contacts present in the phone. For this we usually use below code :

Intent contactPickerIntent = new Intent(Intent.ACTION_PICK,
                ContactsContract.CommonDataKinds.Phone.CONTENT_URI);
        startActivityForResult(contactPickerIntent, RESULT_PICK_CONTACT);

But what should be done to filter the contacts displayed in the list as per the Account Types. For e.g- if I want to show only the contacts which are registered with whatsapp. What shall be done in this case scenario to show only the whats app registered contacts in the Contacts list.

Note : The particular account type contacts can be retrieved by querying the DB, but in that case we need to create our own contact list to display the filtered contacts. The motive is to use the contact apps list to display the filtered contacts.