List of usage examples for android.content Intent addFlags
public @NonNull Intent addFlags(@Flags int flags)
From source file:de.madvertise.android.sdk.Ad.java
/** * Handles the click action (opens the click url) *///from w w w.jav a 2 s. c o m protected void handleClick() { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(clickURL)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { context.startActivity(intent); } catch (Exception e) { MadUtil.logMessage(null, Log.DEBUG, "Failed to open URL : " + clickURL); e.printStackTrace(); } }
From source file:cn.com.incardata.autobon_shops.CooperativeThreeActivity.java
public void showTipsDialog() { final CheckTipsDialog dialog = new CheckTipsDialog(this, R.style.TipsDialog); dialog.setOnPositiveListener(new View.OnClickListener() { @Override//from www . j a v a 2s .c om public void onClick(View view) { dialog.dismiss(); //TODO ? } }); dialog.show(); dialog.setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { Intent intent = new Intent(getContext(), LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); } }); }
From source file:com.aqnote.app.wifianalyzer.MainActivity.java
private void reloadActivity() { finish();/*from w w w . j a v a2s . c o m*/ Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); }
From source file:com.oakesville.mythling.MainActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getAppSettings().isFirstRun()) { new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert) .setTitle(getString(R.string.setup_required)) .setMessage(getString(R.string.access_network_settings)) .setPositiveButton(getString(R.string.go_to_settings), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { startActivity(new Intent(MainActivity.this, PrefsActivity.class)); }/*w w w .ja v a 2s. c o m*/ }).show(); } setContentView(getAppSettings().isTv() ? R.layout.firetv_split : R.layout.split); findViewById(R.id.breadcrumbs).setVisibility(View.GONE); createProgressBar(); backTo = getIntent().getStringExtra("back_to"); setPathFromIntent(); setSelItemIndex(getIntent().getIntExtra(SEL_ITEM_INDEX, 0)); setTopOffset(getIntent().getIntExtra(TOP_OFFSET, 0)); setCurrentTop(getIntent().getIntExtra(CURRENT_TOP, 0)); String mode = getIntent().getStringExtra(MODE_SWITCH); modeSwitch = mode != null; if (mode == null) mode = getAppSettings().getMediaSettings().getViewType().toString(); if (ViewType.list.toString().equals(mode)) goListView(); else if (ViewType.split.toString().equals(mode)) goSplitView(); if (getAppSettings().getMediaSettings().getViewType() == ViewType.detail) { Intent intent = new Intent(this, MediaPagerActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); if (backTo != null) intent.putExtra("back_to", backTo); startActivity(intent); finish(); return; } listView = (ListView) findViewById(R.id.split_cats); }
From source file:com.cssweb.android.common.FairyUI.java
public static Intent genIntent(int paramInt1, String paramString1, String paramString2, String paramString3, Context paramContext) {//from w w w . j a v a 2s . c o m Intent localIntent = new Intent(); // localIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); localIntent.putExtra("exchange", paramString1); localIntent.putExtra("stockcode", paramString2); localIntent.putExtra("stockname", paramString3); switch (paramInt1) { case Global.QUOTE_KLINE: localIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); if (CssSystem.getSDKVersionNumber() == 4) localIntent.setClass(paramContext, KLine2Activity.class); else localIntent.setClass(paramContext, KLineActivity.class); break; case Global.QUOTE_F10: if ("hk".equals(paramString1)) { StringBuffer sb = new StringBuffer(); sb.append(Config.roadf10); sb.append("hkf10/mobile/index.jsp?stockcode="); sb.append(paramString1); sb.append(paramString2); localIntent.putExtra("url", sb.toString()); localIntent.setClass(paramContext, WebViewDisplay.class); } else if ("cf".equals(paramString1) || "dc".equals(paramString1) || "sf".equals(paramString1) || "cz".equals(paramString1)) { StringBuffer sb = new StringBuffer(); sb.append(Config.roadf10); sb.append("hkf10/front/tbobject3511/indexM.jsp?stockcode="); sb.append(paramString1); sb.append(paramString2); localIntent.putExtra("url", sb.toString()); localIntent.setClass(paramContext, WebViewDisplay.class); } else { StringBuffer sb = new StringBuffer(); sb.append(Config.roadZixun); sb.append("iphone/f10/index_forword.jsp?code="); sb.append(paramString1); sb.append(paramString2); localIntent.putExtra("url", sb.toString()); localIntent.setClass(paramContext, WebViewDisplay.class); //localIntent.setClass(paramContext, GetF10List.class); } break; case Global.QUOTE_FENSHI: localIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); localIntent.setClass(paramContext, TrendActivity.class); break; case Global.QUOTE_BAOJIA: localIntent.setClass(paramContext, QuotePrice.class); break; case Global.QUOTE_MINGXI: localIntent.setClass(paramContext, QuoteDetail.class); break; case Global.QUOTE_FLINE: localIntent.setClass(paramContext, FLineActivity.class); break; case Global.QUOTE_USERSTK: localIntent.putExtra("requestType", 1); localIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); localIntent.setClass(paramContext, PersonalStock.class); break; case Global.QUOTE_WARN: localIntent.putExtra("requestType", 1); localIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); localIntent.setClass(paramContext, QuoteSet.class); break; default: localIntent.setClass(paramContext, TrendActivity.class); break; } return localIntent; }
From source file:com.ushahidi.android.app.BackgroundService.java
private void showNotification(String tickerText) { // This is what should be launched if the user selects our notification. Intent baseIntent = new Intent(this, IncidentTab.class); baseIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, baseIntent, 0); // choose the ticker text newUshahidiReportNotification = new Notification(R.drawable.notification_icon, tickerText, System.currentTimeMillis()); newUshahidiReportNotification.contentIntent = contentIntent; newUshahidiReportNotification.flags = Notification.FLAG_AUTO_CANCEL; newUshahidiReportNotification.defaults = Notification.DEFAULT_ALL; newUshahidiReportNotification.setLatestEventInfo(this, TAG, tickerText, contentIntent); if (Preferences.ringtone) { // set the ringer Uri ringURI = Uri.fromFile(new File("/system/media/audio/ringtones/ringer.mp3")); newUshahidiReportNotification.sound = ringURI; }//from w w w .j a v a 2s . c om if (Preferences.vibrate) { double vibrateLength = 100 * Math.exp(0.53 * 20); long[] vibrate = new long[] { 100, 100, (long) vibrateLength }; newUshahidiReportNotification.vibrate = vibrate; if (Preferences.flashLed) { int color = Color.BLUE; newUshahidiReportNotification.ledARGB = color; } newUshahidiReportNotification.ledOffMS = (int) vibrateLength; newUshahidiReportNotification.ledOnMS = (int) vibrateLength; newUshahidiReportNotification.flags = newUshahidiReportNotification.flags | Notification.FLAG_SHOW_LIGHTS; } mNotificationManager.notify(Preferences.NOTIFICATION_ID, newUshahidiReportNotification); }
From source file:com.ushahidi.android.app.UshahidiService.java
private void showNotification(String tickerText) { // This is what should be launched if the user selects our notification. Intent baseIntent = new Intent(this, IncidentsTab.class); baseIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, baseIntent, 0); // choose the ticker text newUshahidiReportNotification = new Notification(R.drawable.favicon, tickerText, System.currentTimeMillis()); newUshahidiReportNotification.contentIntent = contentIntent; newUshahidiReportNotification.flags = Notification.FLAG_AUTO_CANCEL; newUshahidiReportNotification.defaults = Notification.DEFAULT_ALL; newUshahidiReportNotification.setLatestEventInfo(this, TAG, tickerText, contentIntent); if (UshahidiPref.ringtone) { // set the ringer Uri ringURI = Uri.fromFile(new File("/system/media/audio/ringtones/ringer.mp3")); newUshahidiReportNotification.sound = ringURI; }//from ww w . ja v a 2 s . c o m if (UshahidiPref.vibrate) { double vibrateLength = 100 * Math.exp(0.53 * 20); long[] vibrate = new long[] { 100, 100, (long) vibrateLength }; newUshahidiReportNotification.vibrate = vibrate; if (UshahidiPref.flashLed) { int color = Color.BLUE; newUshahidiReportNotification.ledARGB = color; } newUshahidiReportNotification.ledOffMS = (int) vibrateLength; newUshahidiReportNotification.ledOnMS = (int) vibrateLength; newUshahidiReportNotification.flags = newUshahidiReportNotification.flags | Notification.FLAG_SHOW_LIGHTS; } mNotificationManager.notify(UshahidiPref.NOTIFICATION_ID, newUshahidiReportNotification); }
From source file:at.wada811.dayscounter.CrashExceptionHandler.java
/** * ????????JSON?????// w ww . ja va 2 s . c om */ @TargetApi(Build.VERSION_CODES.HONEYCOMB) @Override public void uncaughtException(Thread thread, Throwable throwable) { // make Crash report CrashExceptionHandler.makeReportFile(mContext, throwable); // launch CrashReportActivity Intent intent = new Intent(mContext, CrashReportActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); mContext.startActivity(intent); // mHandler.uncaughtException(thread, throwable); }
From source file:com.wbs.itm.SelectedQuestionActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.all_ans);// ww w.ja v a2 s . com selquesList = new ArrayList<HashMap<String, String>>(); Intent newqestionintent = getIntent(); String newquestion = newqestionintent.getExtras().getString("TAG_QUESTION"); new LoadAllSelques().execute(); TextView text = (TextView) findViewById(R.id.selectedquestion); text.setText("Q. "); text.append(newquestion); ListView lv = getListView(); Button gohome = (Button) findViewById(R.id.gohome); gohome.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(getApplicationContext(), TalkyLaunchActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); } }); Button ansbtn = (Button) findViewById(R.id.ansbtn); ansbtn.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { newqintent = getIntent(); newqid = newqintent.getExtras().getString("TAG_PID"); /*String newpid = ((TextView) findViewById(R.id.qid)).getText() .toString();*/ Intent mynewIntent = new Intent(SelectedQuestionActivity.this, NewAnswerActivity.class); mynewIntent.putExtra("TAG_newPID", newqid); SelectedQuestionActivity.this.startActivity(mynewIntent); } }); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // getting values from selected ListItem // Do nothing! //Later on implement selective Replies. } }); }
From source file:de.madvertise.android.sdk.MadvertiseAd.java
/** * Handles the click action (opens the click url) *//*from w ww . j a v a2s .com*/ protected void handleClick() { if (mClickUrl != null && !mClickUrl.equals("")) { Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(mClickUrl)); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); try { mContext.startActivity(intent); if (mCallbackListener != null) { mCallbackListener.onAdClicked(); } } catch (Exception e) { MadvertiseUtil.logMessage(null, Log.DEBUG, "Failed to open URL : " + mClickUrl); if (mCallbackListener != null) { mCallbackListener.onError(e); } e.printStackTrace(); } } }