Time for action - viewing phone book contacts

In this example we will delve a little deeper into the workings of the Android system. We're going to override the default "view contact" option, providing our own Activity to view contacts from the phonebook on the device. When the user tries to open a contact to e-mail or call them, they will be presented with an option to view the contact using our Activity instead of the default one.

  1. Start by creating a new project from the command line:
    android create project -n ContactViewer -p ContactViewer -k com.packtpub.contactviewer -a ViewContactActivity -t 3
    
  2. Open the res/layout/main.xml layout resource in an editor or IDE.
  3. Remove the default content within the LinearLayout element.
  4. Add a new TextView object ...

Get Android User Interface Development now with O’Reilly online learning.

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