本文整理汇总了Java中android.content.Intent.cloneFilter方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.cloneFilter方法的具体用法?Java Intent.cloneFilter怎么用?Java Intent.cloneFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.cloneFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: replacePreviousDelayedAlarm
import android.content.Intent; //导入方法依赖的package包/类
private void replacePreviousDelayedAlarm(String action, int delay) {
PendingIntent pendingIntent;
// Cancel any previous alarm set for a content changed event
if (mLastContentChangedIntent != null) {
pendingIntent = PendingIntent.getBroadcast(mContext, 0, mLastContentChangedIntent, 0);
mAlarmManager.cancel(pendingIntent);
}
// Set a new delayed alarm and save a copy of the intent to send in case we want to cancel it later
Intent intent = new Intent(mContext, WidgetProviderVideo.class);
intent.setAction(action);
intent.setData(Uri.parse(String.valueOf(SystemClock.elapsedRealtime()))); // Fill data with a dummy value to avoid the "extra beeing ignored" optimization of the PendingIntent
intent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
mLastContentChangedIntent = intent.cloneFilter(); // This is enough to identify the intent
pendingIntent = PendingIntent.getBroadcast(mContext, 0, intent, 0);
mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + delay, pendingIntent);
}