Android之AppWidget的按钮事件开启Activity

来源:互联网 发布:淘宝店标图片免费下载 编辑:程序博客网 时间:2024/05/16 08:29

        由于App Widget只提供给我们一个可以使用RemoteViews的方法PendingIntent,因此只能采用PendingIntent方法来传递Intent。使用Intent实例化一个PendingIntent,调用PendingIntent的getActivity来启动另一个Activity。

getActivity的最后一个参数:

FLAG_CANCEL_CURRENT若当前描述的PendingIntent已存在,则取消当前的PendingIntent,重新生成一个。

FLAG_NO_CREATE 若当前描述的PendingIntent已经存在,则取消重新创建,返回null

FLAG_ONE_SHOTPendingIntent只能使用一次

FLAG_UPDATE_CURRENT若当前描述的PendingIntent已经存在,则保留旧的Intent,使用新的Intent数据 替换旧的数据。

 

     

 

 

原创粉丝点击