本文整理汇总了Java中android.content.Intent.makeRestartActivityTask方法的典型用法代码示例。如果您正苦于以下问题:Java Intent.makeRestartActivityTask方法的具体用法?Java Intent.makeRestartActivityTask怎么用?Java Intent.makeRestartActivityTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.content.Intent
的用法示例。
在下文中一共展示了Intent.makeRestartActivityTask方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mainActivityPendingIntent
import android.content.Intent; //导入方法依赖的package包/类
public static PendingIntent mainActivityPendingIntent(Context context, long bookId, long noteId) {
if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, bookId, noteId);
Intent intent = Intent.makeRestartActivityTask(new ComponentName(context, MainActivity.class));
intent.putExtra(AppIntent.EXTRA_BOOK_ID, bookId);
intent.putExtra(AppIntent.EXTRA_NOTE_ID, noteId);
return PendingIntent.getActivity(
context,
Long.valueOf(noteId).intValue(),
intent,
PendingIntent.FLAG_UPDATE_CURRENT);
}
示例2: updateAppWidgetLayout
import android.content.Intent; //导入方法依赖的package包/类
private static void updateAppWidgetLayout(Context context, AppWidgetManager appWidgetManager, int appWidgetId) {
Filter filter = getFilter(context, appWidgetId);
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.list_widget);
Intent serviceIntent = new Intent(context, ListWidgetService.class);
serviceIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
serviceIntent.putExtra(AppIntent.EXTRA_QUERY_STRING, filter.getQuery());
serviceIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME)));
// Tell ListView where to get the data from
remoteViews.setRemoteAdapter(R.id.list_widget_list_view, serviceIntent);
remoteViews.setEmptyView(R.id.list_widget_list_view, R.id.list_widget_empty_view);
if (filter.getQuery() == null) {
remoteViews.setTextViewText(R.id.list_widget_empty_view, context.getString(R.string.select_a_filter_long));
} else {
remoteViews.setTextViewText(R.id.list_widget_empty_view, context.getString(R.string.no_notes_found_after_search));
}
// Rows - open note
final Intent onClickIntent = new Intent(context, ListWidgetProvider.class);
onClickIntent.setAction(AppIntent.ACTION_CLICK_LIST_WIDGET);
onClickIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
onClickIntent.setData(Uri.parse(onClickIntent.toUri(Intent.URI_INTENT_SCHEME)));
final PendingIntent onClickPendingIntent = PendingIntent.getBroadcast(context, 0,
onClickIntent, PendingIntent.FLAG_UPDATE_CURRENT);
remoteViews.setPendingIntentTemplate(R.id.list_widget_list_view, onClickPendingIntent);
// Plus icon - new note
remoteViews.setOnClickPendingIntent(R.id.list_widget_header_add, ShareActivity.createNewNoteIntent(context, filter));
// Logo - open query
Intent openIntent = Intent.makeRestartActivityTask(new ComponentName(context, MainActivity.class));
openIntent.putExtra(AppIntent.EXTRA_QUERY_STRING, filter.getQuery());
serviceIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME)));
remoteViews.setOnClickPendingIntent(R.id.list_widget_header_icon, PendingIntent.getActivity(context, 0, openIntent, PendingIntent.FLAG_UPDATE_CURRENT));
Intent filterSelectIntent = new Intent(context, FilterSelectDialogActivity.class);
filterSelectIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
filterSelectIntent.setData(Uri.parse(serviceIntent.toUri(Intent.URI_INTENT_SCHEME)));
remoteViews.setOnClickPendingIntent(R.id.list_widget_header_bar, PendingIntent.getActivity(context, 0, filterSelectIntent, PendingIntent.FLAG_UPDATE_CURRENT));
remoteViews.setTextViewText(
R.id.list_widget_header_filter,
filter.getName());
appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
}
示例3: makeRestartActivityTask
import android.content.Intent; //导入方法依赖的package包/类
public static Intent makeRestartActivityTask(ComponentName mainActivity) {
return Intent.makeRestartActivityTask(mainActivity);
}