List of usage examples for android.content Intent FLAG_ACTIVITY_CLEAR_TOP
int FLAG_ACTIVITY_CLEAR_TOP
To view the source code for android.content Intent FLAG_ACTIVITY_CLEAR_TOP.
Click Source Link
From source file:com.frostwire.android.gui.activities.MainActivity.java
public static void refreshTransfers(Context context) { Intent intent = new Intent(context, MainActivity.class).setAction(Constants.ACTION_SHOW_TRANSFERS) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); try {//from ww w .ja v a 2s . c om context.startActivity(intent); } catch (Throwable t) { LOG.error(t.getMessage(), t); } }
From source file:com.aimfire.demo.CameraActivity.java
private void launchMain() { final Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(MainConsts.EXTRA_MSG, true/*mIsMyMedia*/); /*/*w w w. ja va 2 s. c o m*/ * we want to go back to MainActivity instead of CamcorderActivity * if it was launched before us */ startActivity(intent); /* * exit and release the audio context and disconnect p2p. we do it here instead of * onDestroy because if we switch to CamcorderActivity we don't want to release * audio context or disconnect p2p */ if (mAimfireService != null) { mAimfireService.endDemo(); } /* * exit out of camera, not really necessary because of the CLEAR_TOP */ finish(); }
From source file:github.popeen.dsub.activity.SubsonicActivity.java
public void startFragmentActivity(String fragmentType) { Intent intent = new Intent(); intent.setClass(SubsonicActivity.this, SubsonicFragmentActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); if (!"".equals(fragmentType)) { intent.putExtra(Constants.INTENT_EXTRA_FRAGMENT_TYPE, fragmentType); }//from ww w. jav a2 s . c om if (lastSelectedPosition != 0) { intent.putExtra(Constants.FRAGMENT_POSITION, lastSelectedPosition); } startActivity(intent); finish(); }
From source file:github.daneren2005.dsub.util.Util.java
public static void showPlayingNotification(final Context context, final DownloadServiceImpl downloadService, Handler handler, MusicDirectory.Entry song) { // Set the icon, scrolling text and timestamp final Notification notification = new Notification(R.drawable.stat_notify_playing, song.getTitle(), System.currentTimeMillis()); notification.flags |= Notification.FLAG_NO_CLEAR | Notification.FLAG_ONGOING_EVENT; boolean playing = downloadService.getPlayerState() == PlayerState.STARTED; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { RemoteViews expandedContentView = new RemoteViews(context.getPackageName(), R.layout.notification_expanded); setupViews(expandedContentView, context, song, playing); notification.bigContentView = expandedContentView; }/*from w w w . j a va2 s .co m*/ RemoteViews smallContentView = new RemoteViews(context.getPackageName(), R.layout.notification); setupViews(smallContentView, context, song, playing); notification.contentView = smallContentView; Intent notificationIntent = new Intent(context, MainActivity.class); notificationIntent.putExtra(Constants.INTENT_EXTRA_NAME_DOWNLOAD, true); notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); notification.contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); handler.post(new Runnable() { @Override public void run() { downloadService.startForeground(Constants.NOTIFICATION_ID_PLAYING, notification); } }); // Update widget DSubWidgetProvider.notifyInstances(context, downloadService, true); }
From source file:github.popeen.dsub.activity.SubsonicActivity.java
protected void exit() { if (((Object) this).getClass() != SubsonicFragmentActivity.class) { Intent intent = new Intent(this, SubsonicFragmentActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra(Constants.INTENT_EXTRA_NAME_EXIT, true); Util.startActivityWithoutTransition(this, intent); } else {//from w ww . j a v a 2 s . c o m finished = true; this.stopService(new Intent(this, DownloadService.class)); this.finish(); } }
From source file:com.aimfire.gallery.GalleryActivity.java
/** * Override Activity lifecycle method./*www .ja va 2 s . c om*/ */ @Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent; /* * if user interacted with action bar, delay any scheduled hide() * operations to prevent the jarring behavior of controls going away * while interacting with the UI. */ if (AUTO_HIDE) { delayedHide(AUTO_HIDE_DELAY_SHORT_MILLIS); } switch (item.getItemId()) { case android.R.id.home: intent = new Intent(GalleryActivity.this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(MainConsts.EXTRA_MSG, mIsMyMedia); startActivity(intent); break; case R.id.action_share: createDriveLink(); break; case R.id.action_thumb_view: switchThumbView(); break; case R.id.action_delete: deleteFile(); break; case R.id.action_anaglyph: if (!item.isChecked()) { mDisplayMode = DisplayMode.Anaglyph; if (item.getTitle().equals(getString(R.string.action_anaglyph_cyanred))) { mDisplaySwap = true; } else { mDisplaySwap = false; } item.setChecked(true); updateDisplayPrefs(); invalidateOptionsMenu(); switchDisplayMode(); } break; case R.id.action_sbs: if (!item.isChecked()) { mDisplayMode = DisplayMode.SbsFull; if (item.getTitle().equals(getString(R.string.action_sbs_cross))) { mDisplaySwap = true; } else { mDisplaySwap = false; } item.setChecked(true); updateDisplayPrefs(); invalidateOptionsMenu(); switchDisplayMode(); } break; case R.id.action_3dtv: if (!item.isChecked()) { mDisplayMode = DisplayMode.SbsHalf; item.setChecked(true); updateDisplayPrefs(); invalidateOptionsMenu(); switchDisplayMode(); } break; case R.id.action_swap: if (item.isChecked()) { mDisplaySwap = false; item.setChecked(false); } else { mDisplaySwap = true; item.setChecked(true); } updateDisplayPrefs(); invalidateOptionsMenu(); switchDisplayMode(); break; case R.id.action_grayscale: if (item.isChecked()) { mDisplayColor = true; item.setChecked(false); } else { mDisplayColor = false; item.setChecked(true); } updateDisplayPrefs(); invalidateOptionsMenu(); switchDisplayMode(); break; default: return super.onOptionsItemSelected(item); } return true; }
From source file:com.eugene.fithealthmaingit.UI.SaveSearchAddItemActivityMain.java
private void saveMeal() { LogMeal logMeals = new LogMeal(); logMeals.setMealId(food_id);//from w ww .j a v a 2 s.c o m logMeals.setMealChoice(mealType); logMeals.setMealName(mFoodName); if (llCalories.getVisibility() == View.VISIBLE) logMeals.setCalorieCount(Double.valueOf(mCalUpdate.getText().toString())); if (llFat.getVisibility() == View.VISIBLE) logMeals.setFatCount(Double.valueOf(mFattieUpdate.getText().toString())); if (llSat.getVisibility() == View.VISIBLE) logMeals.setSaturatedFat(Double.valueOf(mSaturatedFatUpdate.getText().toString())); if (llCholesterol.getVisibility() == View.VISIBLE) logMeals.setCholesterol(Double.valueOf(mCholesterolUpdate.getText().toString())); if (llSodium.getVisibility() == View.VISIBLE) logMeals.setSodium(Double.valueOf(mSodiumUpdate.getText().toString())); if (llCarbs.getVisibility() == View.VISIBLE) logMeals.setCarbCount(Double.valueOf(mCarbUpdate.getText().toString())); if (llFiber.getVisibility() == View.VISIBLE) logMeals.setFiber(Double.valueOf(mFiberUpdate.getText().toString())); if (llSugars.getVisibility() == View.VISIBLE) logMeals.setSugars(Double.valueOf(mSugarUpdate.getText().toString())); if (llProtein.getVisibility() == View.VISIBLE) logMeals.setProteinCount(Double.valueOf(mProUpdate.getText().toString())); if (llVitC.getVisibility() == View.VISIBLE) logMeals.setVitA(Double.valueOf(mVitAUpdate.getText().toString())); if (llVitC.getVisibility() == View.VISIBLE) logMeals.setVitC(Double.valueOf(mVitCUpdate.getText().toString())); if (llCalcium.getVisibility() == View.VISIBLE) logMeals.setCalcium(Double.valueOf(mCalciumUpdate.getText().toString())); if (llIron.getVisibility() == View.VISIBLE) logMeals.setIron(Double.valueOf(mIronUpdate.getText().toString())); if (favorite == true && !meal_favorite.equals("favorite")) { logMeals.setFavorite("favorite"); } else { logMeals.setFavorite("not"); } logMeals.setManualEntry("false"); logMeals.setBrand(food_brand); logMeals.setServingSize(Double.valueOf(mServingg.getText().toString())); logMeals.setMealServing("Serving"); logMeals.setDate(new Date()); logMeals.setOrderFormat(OrderFormat.setMealFormat(mealType)); logMeals.save(); testing(); Intent saveFinish = new Intent(this, MainActivity.class); saveFinish.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(saveFinish); }
From source file:com.synox.android.ui.activity.FileActivity.java
public void restart() { Intent i = new Intent(this, FileDisplayActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i);/*from w ww. j a v a 2 s .c o m*/ }
From source file:co.beem.project.beem.FbTextService.java
public void startForeGroundWithnotification(int statusStringId) { // Notification note=new Notification(R.drawable.ic_stat_pending_notification, // getString(R.string.notification_welcome), // System.currentTimeMillis()); isStartingForeground = true;//from w ww. j a v a 2 s. c om Intent i = new Intent(this, FbTextMainActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0); if (statusStringId == 0) { int statusState = mSettings.getInt(FbTextApplication.STATUS_KEY, 0); statusStringId = statusState == 0 ? R.string.notification_online : R.string.notification_invisible; } Notification note = new NotificationCompat.Builder(this).setContentTitle(getString(statusStringId)) .setContentText(getString(R.string.notification_description)) .setSmallIcon(R.drawable.ic_stat_pending_notification).setContentIntent(pi).build(); /*note.setLatestEventInfo(this, getString(statusStringId), getString(R.string.notification_description), pi);*/ note.flags |= Notification.FLAG_NO_CLEAR; startForeground(1080, note); }