花样Android ProgressBar史上最强大讲解(10)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-15 19:49 点击:次
20.
21. @Override
22. public void onUpdate(Context context, AppWidgetManager appWidgetManager,
23. int[] appWidgetIds) {
24. // TODO Auto-generated method stub
25. super.onUpdate(context, appWidgetManager, appWidgetIds);
26. }
27.
28.}
④配置Manifest,进行注册
Java代码
01.<receiver android:name="AppWidget">
02. <intent-filter>
03. <action android:name="android.appwidget.action.APPWIDGET_UPDATE"></action>
04. </intent-filter>
05. <meta-data
06. android:resource="@xml/appwidget"
07. android:name="android.appwidget.provider">
08. </meta-data>
09.</receiver>
这里实现按钮与进度条的交互。(Widget自己广播发送与接收)
①按钮的消息发送
Java代码
01.@Override
02. public void onUpdate(Context context, AppWidgetManager appWidgetManager,
03. int[] appWidgetIds) {
04. // TODO Auto-generated method stub
05. final int N = appWidgetIds.length;
06.
07. // Perform this loop procedure for each App Widget that belongs to this provider
08. for (int i=0; i<N; i++) {
09. int appWidgetId = appWidgetIds;
10. RemoteViews views=
11.new RemoteViews(context.getPackageName(), R.layout.widgetlayout);
12.
13. Intent UPintent=new Intent("zyf.test.widget.UP");
14. Intent DOWNintent=new Intent("zyf.test.widget.DOWN");
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>