0

My problem is that I store the contacts/persons' _ID in a database and I want to initiate a phone call in order to call the stored contact when the user presses a button.

I retrieve the _ID from a Cursor and store it into a database

String CONT_ID = cursor.getInt(cursor.getColumnIndex(ContactsContract.Contacts._ID)); ...

Later on, when the user presses a button I call

 Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("content://contacts/people/" + CONT_ID));
 startActivity(intent);

Now the problem is that the dialer is displayed but it is "empty", it does not display the desired person.

So, it seems that it does not fill in the person. The Android development guide says at the Intent description:

ACTION_DIAL content://contacts/people/1 -- Display the phone dialer with the person filled in.

How else should I fill in the desired person? Any hint?

pittnerf
  • 739
  • 1
  • 6
  • 17

1 Answers1

0

Uri.parse("content://contacts/people/" + CONT_ID)

Here you are expecting content://contacts/people/ + CONT_ID should give the phone number but it will not happen bcoz you need to query content provider.

Note: Please refer this link to fetch contacts:

Fetch Contacts in android application

Community
  • 1
  • 1
Vineet Shukla
  • 23,865
  • 10
  • 55
  • 63