List of usage examples for android.content Intent FLAG_ACTIVITY_MULTIPLE_TASK
int FLAG_ACTIVITY_MULTIPLE_TASK
To view the source code for android.content Intent FLAG_ACTIVITY_MULTIPLE_TASK.
Click Source Link
From source file:org.deviceconnect.android.localoauth.LocalOAuth2Main.java
/** * ??????./* w w w.ja v a2 s. c om*/ * @param request */ public void startConfirmAuthActivity(final ConfirmAuthRequest request) { if (request == null) { return; } android.content.Context context = request.getConfirmAuthParams().getContext(); long threadId = request.getThreadId(); ConfirmAuthParams params = request.getConfirmAuthParams(); String[] displayScopes = request.getDisplayScopes(); // Activity(??????ApprovalHandler??) Intent intent = new Intent(); intent.setClass(params.getContext(), ConfirmAuthActivity.class); intent.putExtra(ConfirmAuthActivity.EXTRA_THREAD_ID, threadId); if (params.getServiceId() != null) { intent.putExtra(ConfirmAuthActivity.EXTRA_SERVICE_ID, params.getServiceId()); } intent.putExtra(ConfirmAuthActivity.EXTRA_APPLICATION_NAME, params.getApplicationName()); intent.putExtra(ConfirmAuthActivity.EXTRA_SCOPES, params.getScopes()); intent.putExtra(ConfirmAuthActivity.EXTRA_DISPLAY_SCOPES, displayScopes); intent.putExtra(ConfirmAuthActivity.EXTRA_REQUEST_TIME, request.getRequestTime()); intent.putExtra(ConfirmAuthActivity.EXTRA_IS_FOR_DEVICEPLUGIN, params.isForDevicePlugin()); if (!params.isForDevicePlugin()) { intent.putExtra(ConfirmAuthActivity.EXTRA_PACKAGE_NAME, context.getPackageName()); intent.putExtra(ConfirmAuthActivity.EXTRA_KEYWORD, params.getKeyword()); } intent.putExtra(ConfirmAuthActivity.EXTRA_AUTO_FLAG, request.isAutoFlag()); intent.setFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); request.startTimer(new ConfirmAuthRequest.OnTimeoutCallback() { @Override public void onTimeout() { processApproval(request.getThreadId(), false); } }); }
From source file:com.tct.mail.compose.ComposeActivity.java
private static void launch(Context context, Account account, Message message, int action, String toAddress, String body, String quotedText, String subject, final ContentValues extraValues) { //TS: xujian 2015-06-23 EMAIL BUGFIX_1015657 MOD_S if (message != null && message.bodyHtml != null && message.bodyHtml.length() > 1024 * 5) { message.bodyHtml = ""; LogUtils.d("Email", "test---launch---bodyHtml set to empty"); }/* www . java 2 s .c om*/ if (message != null && message.bodyText != null && message.bodyText.length() > 1024 * 5) { message.bodyText = ""; LogUtils.d("Email", "test---launch---bodyText set to empty"); } //TS: xujian 2015-06-23 EMAIL BUGFIX_1015657 MOD_E //Note: intent can not take too much extra data, so not take these two string in extra data. if (message != null) { message.bodyHtmlLinkify = ""; message.bodyTextLinkify = ""; } Intent intent = new Intent(ACTION_LAUNCH_COMPOSE); intent.setPackage(context.getPackageName()); intent.putExtra(EXTRA_FROM_EMAIL_TASK, true); intent.putExtra(EXTRA_ACTION, action); intent.putExtra(Utils.EXTRA_ACCOUNT, account); if (action == EDIT_DRAFT) { intent.putExtra(ORIGINAL_DRAFT_MESSAGE, message); } else { intent.putExtra(EXTRA_IN_REFERENCE_TO_MESSAGE, message); } if (message != null) { LogUtils.d("Email", String.format("test---launch---action=%d messageId=%d conversationUri=%s uri=%s subject=%s", action, message.id, message.conversationUri, message.uri, message.subject)); } //TS: wenggangjin 2015-01-06 EMAIL BUGFIX_882161 MOD_S // if(message != null && message.bodyHtml != null && message.bodyHtml.length() > 1024*10){ // message.bodyHtml = ""; // Log.d("Email","test---launch---bodyHtml set to empty"); // } //TS: wenggangjin 2015-01-06 EMAIL BUGFIX_882161 MOD_E if (toAddress != null) { intent.putExtra(EXTRA_TO, toAddress); } if (body != null) { intent.putExtra(EXTRA_BODY, body); } if (quotedText != null) { intent.putExtra(EXTRA_QUOTED_TEXT, quotedText); } if (subject != null) { intent.putExtra(EXTRA_SUBJECT, subject); } if (extraValues != null) { LogUtils.d(LOG_TAG, "Launching with extraValues: %s", extraValues.toString()); intent.putExtra(EXTRA_VALUES, extraValues); } if (action == COMPOSE) { intent.setFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); } else if (message != null) { //TS: jin.dong 2015-10-19 EMAIL BUGFIX_1100033 ADD_S if (message.uri == null) { LogUtils.e(LOG_TAG, "what ? message's uri is null? want launch ComposeActivity ? do nothing is the right thing!!!"); return; } //TS: jin.dong 2015-10-19 EMAIL BUGFIX_1100033 ADD_E //TS: yanhua.chen 2016-03-31 EMAIL BUGFIX_1877378 ADD_S intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); //TS: yanhua.chen 2016-03-31 EMAIL BUGFIX_1877378 ADD_E intent.setData(Utils.normalizeUri(message.uri)); } // TS: xiaolin.li 2015-01-29 EMAIL BUGFIX-917401 ADD_S //context.startActivity(intent); try { context.startActivity(intent); } catch (Exception e) { LogUtils.e(LOG_TAG, "Launch compose activity err."); } // TS: xiaolin.li 2015-01-29 EMAIL BUGFIX-917401 ADD_E }
From source file:org.mozilla.gecko.GeckoApp.java
public void doRestart(String action) { Log.i(LOGTAG, "doRestart(\"" + action + "\")"); try {//from w w w . ja v a2s.co m Intent intent = new Intent(action); intent.setClassName(getPackageName(), getPackageName() + ".Restarter"); /* TODO: addEnvToIntent(intent); */ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK); Log.i(LOGTAG, intent.toString()); GeckoAppShell.killAnyZombies(); startActivity(intent); } catch (Exception e) { Log.i(LOGTAG, "error doing restart", e); } finish(); // Give the restart process time to start before we die GeckoAppShell.waitForAnotherGeckoProc(); }