1. AppWidget设计概述
http://developer.android.com/design/patterns/widgets.html
2. AppWidget设计指南
3. AppWidget详细介绍
http://developer.android.com/guide/topics/appwidgets/index.html
4. AppWidgetProvider: 实现AppWidget provider
http://developer.android.com/reference/android/appwidget/AppWidgetProvider.html
5. AppWidgetProviderInfo: 描述AppWidget provider元数据,与 <appwidget-provider> xml标签对应
http://developer.android.com/reference/android/appwidget/AppWidgetProviderInfo.html
6. AppWidgetHost
http://developer.android.com/reference/android/appwidget/AppWidgetHost.html
Keeping Collection Data Fresh
The following figure illustrates the flow that occurs in an app widget that uses collections when updates occur. It shows how the app widget code interacts with the RemoteViewsFactory
, and how you can trigger updates:
One feature of app widgets that use collections is the ability to provide users with up-to-date content. For example, consider the Android 3.0 Gmail app widget, which provides users with a snapshot of their inbox. To make this possible, you need to be able to trigger your RemoteViewsFactory
and collection view to fetch and display new data. You achieve this with the AppWidgetManager
call notifyAppWidgetViewDataChanged()
. This call results in a callback to your RemoteViewsFactory
’s onDataSetChanged()
method, which gives you the opportunity to fetch any new data. Note that you can perform processing-intensive operations synchronously within theonDataSetChanged()
callback. You are guaranteed that this call will be completed before the metadata or view data is fetched from the RemoteViewsFactory
. In addition, you can perform processing-intensive operations within the getViewAt()
method. If this call takes a long time, the loading view (specified by theRemoteViewsFactory
’s getLoadingView()
method) will be displayed in the corresponding position of the collection view until it returns.