1 <?xml version="1.0" encoding="UTF-8"?><!-- 2 Copyright 2013 The Android Open Source Project 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 --> 16 <sample> 17 <name>WidgetData</name> 18 <group>Content</group> 19 <package>com.example.android.widgetdata</package> 20 21 <!-- change minSdk if needed--> 22 <minSdk>11</minSdk> 23 24 <strings> 25 <intro> 26 <![CDATA[ 27 This sample demonstrates how to create a list-based widget specifically backed by a 28 content provider.\n\n 29 This sample uses a collection view (a ListView) to present some mock weather data in a widget. 30 In particular, we will be using a content provider to demonstrate how the widget can retrieve data 31 and update itself when you are using more complex data sources. 32 When working with external data, or data which must be fetched over high latency, it is important 33 to keep the data cached in a persistent location so that the widget feels responsive. 34 ]]> 35 </intro> 36 </strings> 37 38 <template src="base" /> 39 <template src="FragmentView" /> 40 <common src="activities"/> 41 <common src="logger" /> 42 43 <metadata> 44 <status>PUBLISHED</status> 45 <categories>Content</categories> 46 <technologies>Android</technologies> 47 <languages>Java</languages> 48 <solutions>Mobile</solutions> 49 <level>INTERMEDIATE</level> 50 <icon>screenshots/icon-web.png</icon> 51 <screenshots> 52 <img>screenshots/1-widget.png</img> 53 </screenshots> 54 <api_refs> 55 <android>android.widget.RemoteViews</android> 56 <android>android.widget.RemoteViewsService</android> 57 <android>android.database.ContentObserver</android> 58 <android>android.content.ContentResolver</android> 59 </api_refs> 60 <description> 61 <![CDATA[ 62 This sample demonstrates how to create a list-based widget specifically backed 63 by a content provider. 64 ]]> 65 </description> 66 <intro> 67 <![CDATA[ 68 This sample uses a collection view (a ListView) to present some mock weather data in a widget. 69 In particular, we will be using a content provider to demonstrate how the widget can retrieve data 70 and update itself when you are using more complex data sources. 71 When working with external data, or data which must be fetched over high latency, it is important 72 to keep the data cached in a persistent location so that the widget feels responsive. 73 74 We define a [ContentProvider][1] that handles queries from a [RemoteView][2] [ListView][3] widget. 75 A [ContentObserver][4] notifies the widget when data changes in the ContentProvider. 76 Data for the widget is provided by a [RemoteViewsService][5] that populates a RemoteView collection (the ListView). 77 78 [1]: http://developer.android.com/reference/android/content/ContentProvider.html 79 [2]: http://developer.android.com/reference/android/widget/RemoteViews.RemoteView.html 80 [3]: http://developer.android.com/reference/android/widget/ListView.html 81 [4]: http://developer.android.com/reference/android/database/ContentObserver.html 82 [5]: http://developer.android.com/reference/android/widget/RemoteViewsService.html 83 ]]> 84 </intro> 85 </metadata> 86 </sample> 87