Gilles Debunne | 55f4a60 | 2010-06-17 15:02:41 -0700 | [diff] [blame] | 1 | <p>This sample demonstrates the use of XML adapters.</p> |
| 2 | |
| 3 | <p>An XML Adapter is an XML file which defines the bindings between the data |
| 4 | retrieved from a |
| 5 | <a href="../../../reference/android/content/ContentProvider.html"><code>ContentProvider</code></a> |
| 6 | and the different views of a layout. They are provided by the |
| 7 | <a href="../../../reference/android/widget/Adapters.html"><code>Adapters</code></a> |
| 8 | class.</p> |
| 9 | |
| 10 | Three list activities are provided which illustrate this: |
| 11 | <ul> |
| 12 | <li><a href="src/com/example/android/xmladapters/ContactsListActivity.html"><strong> |
| 13 | ContactsListActivity</strong></a> uses the device's Contacts provider as its input source. |
| 14 | Contacts with a phone number are displayed, their photo being retrieved by a dedicated |
| 15 | <a href="src/com/example/android/xmladapters/ContactPhotoBinder.html"><code>ContactPhotoBinder |
| 16 | </code></a>.</li> |
| 17 | |
| 18 | <li><a href="src/com/example/android/xmladapters/PhotosListActivity.html"><strong> |
| 19 | PhotosListActivity</strong></a> retrieves an RSS photo feed and displays the images and their |
| 20 | titles. The images are downloaded from the URL found in the feed using the |
| 21 | <a href="src/com/example/android/xmladapters/ImageDownloader.html"><code>ImageDownloader</code> |
| 22 | </a> helper class.</li> |
| 23 | |
| 24 | <li><a href="src/com/example/android/xmladapters/RssReaderActivity.html"><strong> |
| 25 | RssReaderActivity</strong></a> also displays items extracted from an RSS feed. An additional |
| 26 | <a href="src/com/example/android/xmladapters/UrlIntentListener.html"><code>UrlIntentListener |
| 27 | </code></a> is used to open a browser when one of the news item is tapped.</li> |
| 28 | </ul> |
| 29 | |
| 30 | <img alt="XmlPhotosAdapter" src="../images/XmlPhotosAdapter.png" /> |
| 31 | <img alt="XmlRssReader" src="../images/XmlRssReader.png" /> |