1<p>This sample demonstrates how to create a list-based widget specifically backed by a content provider.<br/> 2<em>Please make sure that you understand the earlier stack widget sample code before delving into this example 3 (see <a href="../StackWidget/index.html">StackWidget</a>).</em></p> 4 5<p>As in the StackWidget example, we will be using a collection view (the ListView in this case) to 6present some mock weather data in a widget. In particular, we will be using a content provider to 7demonstrate how the widget can retrieve data and update itself when you are using more complex data 8sources. When working with external data, or data which must be fetched over high latency, it is 9important to keep the data cached in a persistent location so that the widget feels responsive.</p> 10 11<p>This sample uses the following classes: 12 <ul> 13 <li><a href="src/com/example/android/weatherlistwidget/WeatherDataProvider.html"><code>WeatherDataProvider</code></a> — 14 Our ContentProvider which stores the weather data for this sample. Note that for simplicity, 15 it currently stores the data in memory as opposed to an external and persistent storage such 16 as a file, network location, database, or shared preference. 17 </li> 18 <li><a href="src/com/example/android/weatherlistwidget/WeatherWidgetProvider.html"><code>WeatherWidgetProvider</code></a> — 19 Our AppWidgetProvider which handles specific intent actions (such as when an item is clicked, 20 or the refresh button is pressed). It also sets up the RemoteViews for the widget and binds 21 the service to the collection view in the widget. 22 </li> 23 <li><a href="src/com/example/android/weatherlistwidget/WeatherWidgetService.html"><code>WeatherWidgetService</code></a> — 24 Our RemoteViewsService which manages the creation of new factories, which return the RemoteViews 25 for each item in the ListView. 26 </li> 27 </ul> 28</p> 29 30<p>If you are writing collection-based widgets, remember that the feature is 31supported only on Android 3.0 (API level 11) and higher versions of the platform. 32Remember to add the following to the application's manifest publishing to Google Play:</p> 33 34<ul> 35<li><code><uses-sdk android:minSdkVersion="11" /></code>, which indicates 36to Google Play and the platform that your application requires Android 3.0 or 37higher. For more information, see the <a href="../../../guide/appendix/api-levels.html">API Levels</a> 38and the documentation for the 39<a href="../../../guide/topics/manifest/uses-sdk-element.html"><code><uses-sdk></code></a> 40element.</li> 41</ul> 42 43<img alt="Screenshot" src="../images/WeatherListWidget.png" />