AppWidget进阶篇
在appWidget中事件可分成三种类型
a、开启Activity
b、开始Service
c、发送按钮Action
下面开始一个一个分析,如何实现。
2.1、开启Activity
2.11、首先先定义个开启Activity的intent
eg: Intent fullIntent=new Intent(this ,FullScreen.class);
若要传递数据,则使用intent.putExtra()方法
eg: fullIntent.putExtra(“isCircle”, isCircle);
2.12、用intent实例化一个PendingIntent,调用pendingIntent的getActicity方法来启动另一个Activity
①若该Intent带有数据,则需要将最后一个参数的值设为:FLAG_CANCEL_CURREN
eg:PendingIntent Pfullintent=PendingIntent.getActivity(this,0,fullIntent, PendingIntent.FLAG_CANCEL_CURRENT);
②若该Intent不带数据,则最后一个参数设为0
eg: PendingIntent Pfullintent= PendingIntent.getActivity(this, 0, fullIntent, 0);
2.13、实例化RemoteView,其对应相应的Widget布局
eg: RemoteViews views= new RemoteViews(getPackageName(), R.layout.widget);
2.14、给RemoteV