當前位置: 首頁>>代碼示例>>Java>>正文


Java Intent.makeRestartActivityTask方法代碼示例

本文整理匯總了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);
}
 
開發者ID:orgzly,項目名稱:orgzly-android,代碼行數:14,代碼來源:ActivityUtils.java

示例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);
}
 
開發者ID:orgzly,項目名稱:orgzly-android,代碼行數:50,代碼來源:ListWidgetProvider.java

示例3: makeRestartActivityTask

import android.content.Intent; //導入方法依賴的package包/類
public static Intent makeRestartActivityTask(ComponentName mainActivity) {
    return Intent.makeRestartActivityTask(mainActivity);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:4,代碼來源:IntentCompatHoneycomb.java


注:本文中的android.content.Intent.makeRestartActivityTask方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。