Please, is it possible to pick from contacts only with phone number/s using intent and default contacts app?
Maybe some modification of this (shows selection from all contacts):
Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, CONTACT_PICKER_ID);
Intent Object - Action to make Phone CallIntent phoneIntent = new Intent(Intent. ACTION_CALL); You can use ACTION_DIAL action instead of ACTION_CALL, in that case you will have option to modify hardcoded phone number before making a call instead of making a direct call.
Open your Contacts app and tap the Options button (three dots), and select Contacts Manager. On the next screen, tap on Contacts to display from the menu. Next, if you only want contacts with a phone number, tap on Phone.
* ContactsContract defines an extensible database of contact-related. * information. Contact information is stored in a three-tier data model: * </p>
Intent intent = new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI);
intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE);
startActivityForResult(intent, 1);
You can open a cursor on the contacts and run through getting the contacts with phone numbers. You could recreate the contact picker activity that is shown from the intent you mentioned using this cursor (throwing them into a listview to pick from)
ContentResolver cr = getContentResolver();
Cursor phoneCur = cr.query(
ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
null,
null,
null,
null);
while (phoneCur.moveToNext()) {
String phone = phoneCur.getString(
phoneCur.getColumnIndex(
ContactsContract.CommonDataKinds.Phone.DATA));
//do something, check if empty...
}
phoneCur.close();
with this approach you will also need the read contact permission in you manifest
<uses-permission android:name="android.permission.READ_CONTACTS"/>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With