在AppWidgetProvider
中使用PendingIntent
时,我正在使用以下代码:
views.setOnClickPendingIntent( viewId,
PendingIntent.getBroadcast( context, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT ) );
目前没有保留对由getBroadcast方法返回的PendingIntent的引用。在特定情况下,我现在想取消PendingIntent。是否有办法从View中获取PendingIntent?或者唯一的方法是保留对其引用,并随后调用PendingIntent的cancel方法?