本文整理匯總了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);
}