您的位置:首页 > 移动开发

Android: AppWidget开发官方文档

2014-07-07 11:11 429 查看
1. AppWidget设计概述

http://developer.android.com/design/patterns/widgets.html

2. AppWidget设计指南

http://developer.android.com/guide/practices/ui_guidelines/widget_design.html#anatomy_determining_size

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 the
onDataSetChanged()
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 the
RemoteViewsFactory
’s
getLoadingView()
method) will be displayed in the corresponding position of the collection view until it returns.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: