Joe Malin | 421435d | 2013-01-15 15:06:08 -0800 | [diff] [blame] | 1 | page.title=Accessing Contacts Data |
| 2 | |
| 3 | trainingnavtop=true |
| 4 | startpage=true |
| 5 | |
| 6 | @jd:body |
| 7 | |
| 8 | <div id="tb-wrapper"> |
| 9 | <div id="tb"> |
| 10 | |
| 11 | <!-- Required platform, tools, add-ons, devices, knowledge, etc. --> |
| 12 | <h2>Dependencies and prerequisites</h2> |
| 13 | <ul> |
| 14 | <li>Android 2.0 (API Level 5) or higher</li> |
| 15 | <li>Experience in using {@link android.content.Intent} objects</li> |
| 16 | <li>Experience in using content providers</li> |
| 17 | </ul> |
| 18 | |
| 19 | <!-- related docs (NOT javadocs) --> |
| 20 | <h2>You should also read</h2> |
| 21 | <ul> |
| 22 | <li> |
| 23 | <a href="{@docRoot}guide/topics/providers/content-provider-basics.html"> |
| 24 | Content Provider Basics</a> |
| 25 | </li> |
| 26 | <li> |
| 27 | <a href="{@docRoot}guide/topics/providers/contacts-provider.html"> |
| 28 | Contacts Provider</a> |
| 29 | </li> |
| 30 | </ul> |
| 31 | |
| 32 | <h2>Try it out</h2> |
| 33 | |
| 34 | <div class="download-box"> |
| 35 | <a href="http://developer.android.com/shareables/training/ContactsList.zip" class="button"> |
| 36 | Download the sample |
| 37 | </a> |
| 38 | <p class="filename">ContactsList.zip</p> |
| 39 | </div> |
| 40 | |
| 41 | </div> |
| 42 | </div> |
| 43 | |
| 44 | <p> |
| 45 | The <a href="{@docRoot}guide/topics/providers/contacts-provider.html">Contacts Provider</a> is |
| 46 | the central repository of the user's contacts information, including data from contacts apps and |
| 47 | social networking apps. In your apps, you can access Contacts Provider information directly by |
| 48 | calling {@link android.content.ContentResolver} methods or by sending intents to a contacts app. |
| 49 | </p> |
| 50 | <p> |
| 51 | This class focuses on retrieving lists of contacts, displaying the details for a particular |
| 52 | contact, and modifying contacts using intents. The basic techniques described |
| 53 | here can be extended to perform more complex tasks. In addition, this class helps you |
| 54 | understand the overall structure and operation of the |
| 55 | <a href="{@docRoot}guide/topics/providers/contacts-provider.html">Contacts Provider</a>. |
| 56 | </p> |
| 57 | <h2>Lessons</h2> |
| 58 | |
| 59 | <dl> |
| 60 | <dt> |
| 61 | <b><a href="retrieve-names.html">Retrieving a List of Contacts</a></b> |
| 62 | </dt> |
| 63 | <dd> |
| 64 | Learn how to retrieve a list of contacts for which the data matches all or part of a search |
| 65 | string, using the following techniques: |
| 66 | <ul> |
| 67 | <li>Match by contact name</li> |
| 68 | <li>Match any type of contact data</li> |
| 69 | <li>Match a specific type of contact data, such as a phone number</li> |
| 70 | </ul> |
| 71 | </dd> |
| 72 | <dt> |
| 73 | <b><a href="retrieve-details.html">Retrieving Details for a Contact</a></b> |
| 74 | </dt> |
| 75 | <dd> |
| 76 | Learn how to retrieve the details for a single contact. A contact's details are data |
| 77 | such as phone numbers and email addresses. You can retrieve all details, or you can |
| 78 | retrieve details of a specific type, such as all email addresses. |
| 79 | </dd> |
| 80 | <dt> |
| 81 | <b><a href="modify-data.html">Modifying Contacts Using Intents</a></b> |
| 82 | </dt> |
| 83 | <dd> |
| 84 | Learn how to modify a contact by sending an intent to the People app. |
| 85 | </dd> |
| 86 | <dt> |
| 87 | <b> |
| 88 | <a href="display-contact-badge.html">Displaying the Quick Contact Badge</a> |
| 89 | </b> |
| 90 | </dt> |
| 91 | <dd> |
| 92 | Learn how to display the {@link android.widget.QuickContactBadge} widget. When the user |
| 93 | clicks the contact badge widget, a dialog opens that displays the contact's details and |
| 94 | action buttons for apps that can handle the details. For example, if the contact has an |
| 95 | email address, the dialog displays an action button for the default email app. |
| 96 | </dd> |
| 97 | </dl> |