Challenge: Another Implicit Intent

Instead of sending a crime report, an angry user may prefer a phone confrontation with the suspect. Add a new button that calls the named suspect.

You will need the phone number out of the contacts database. This will require you to query another table in the ContactsContract database called CommonDataKinds.Phone. Check out the documentation for ContactsContract and ContactsContract.CommonDataKinds.Phone for more information on how to query for this information.

A couple of tips: To query for additional data, you can use the android.permission.READ_CONTACTS permission. This is a runtime permission, so you need to explicitly ask the user’s permission to access their contacts. If you would like to ...

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.