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:azad.hallaji.farzad.com.masirezendegi.ExplainMoshaver.java
@Override public void onBackPressed() { DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); if (drawer.isDrawerOpen(GravityCompat.END)) { drawer.closeDrawer(GravityCompat.END); }/*from www . j a va2 s. c om*/ //super.onBackPressed(); Intent intent = new Intent(this, PageMoshaverin.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); finish(); startActivity(intent); }
From source file:com.android.messaging.ui.UIIntentsImpl.java
@Override public Intent getLaunchConversationActivityIntent(final Context context) { final Intent intent = new Intent(context, LaunchConversationActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_HISTORY); return intent; }
From source file:com.shafiq.mytwittle.App.java
public void restartApp(Activity currentActivity) { Intent intent = getBaseContext().getPackageManager() .getLaunchIntentForPackage(getBaseContext().getPackageName()); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NO_ANIMATION | Intent.FLAG_ACTIVITY_CLEAR_TASK); currentActivity.overridePendingTransition(0, 0); currentActivity.startActivity(intent); }
From source file:com.dvn.vindecoder.ui.user.GetAllVehicalDetails.java
@Override public void onAsyncCompleteListener(PostResponse aMasterDataDtos, CallType type) { if (type == CallType.GET_STOP_CAR && aMasterDataDtos.getResponseCode() == 1) { Toast.makeText(GetAllVehicalDetails.this, "Car is deleted sucessfully", Toast.LENGTH_LONG).show(); Intent intent = new Intent(this, UserDetail.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);/* w ww .j av a 2 s.com*/ } else { Toast.makeText(GetAllVehicalDetails.this, "Error in updation try again", Toast.LENGTH_LONG).show(); } }
From source file:com.bonsai.wallet32.WalletService.java
private void showStatusNotification() { CharSequence started_txt = getText(R.string.wallet_service_started); CharSequence info_txt = getText(R.string.wallet_service_info); Notification note = new Notification(R.drawable.ic_stat_notify, started_txt, System.currentTimeMillis()); Intent intent = new Intent(this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent contentIntent = PendingIntent.getActivity(this, 0, intent, 0); // Set the info for the views that show in the notification panel. note.setLatestEventInfo(this, getText(R.string.wallet_service_label), info_txt, contentIntent); note.flags |= Notification.FLAG_NO_CLEAR; startForeground(NOTIFICATION, note); }
From source file:ac.robinson.mediaphone.MediaPhoneActivity.java
public void checkDirectoriesExist() { // nothing will work, and previously saved files will not load if (MediaPhone.DIRECTORY_STORAGE == null) { // if we're not in the main activity, quit everything else and launch the narrative browser to exit if (!((Object) MediaPhoneActivity.this instanceof NarrativeBrowserActivity)) { Intent homeIntent = new Intent(this, NarrativeBrowserActivity.class); homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(homeIntent);/* w ww . ja v a 2 s .c om*/ Log.d(DebugUtilities.getLogTag(this), "Couldn't open storage directory - clearing top to exit"); return; } SharedPreferences mediaPhoneSettings = getSharedPreferences(MediaPhone.APPLICATION_NAME, Context.MODE_PRIVATE); final String storageKey = getString(R.string.key_use_external_storage); if (mediaPhoneSettings.contains(storageKey)) { if (mediaPhoneSettings.getBoolean(storageKey, true)) { // defValue is irrelevant, we know value exists if (!isFinishing()) { UIUtilities.showToast(MediaPhoneActivity.this, R.string.error_opening_narrative_content_sd); } Log.d(DebugUtilities.getLogTag(this), "Couldn't open storage directory (SD card) - exiting"); finish(); return; } } if (!isFinishing()) { UIUtilities.showToast(MediaPhoneActivity.this, R.string.error_opening_narrative_content); } Log.d(DebugUtilities.getLogTag(this), "Couldn't open storage directory - exiting"); finish(); return; } // thumbnail cache won't work, but not really fatal (thumbnails will be loaded into memory on demand) if (MediaPhone.DIRECTORY_THUMBS == null) { Log.d(DebugUtilities.getLogTag(this), "Thumbnail directory not found"); } // external narrative sending (Bluetooth/YouTube etc) may not work, but not really fatal (will warn on export) if (MediaPhone.DIRECTORY_TEMP == null) { Log.d(DebugUtilities.getLogTag(this), "Temporary directory not found - will warn before narrative export"); } // bluetooth directory availability may have changed if we're calling from an SD card availability notification configureBluetoothObserver(PreferenceManager.getDefaultSharedPreferences(MediaPhoneActivity.this), getResources()); }
From source file:com.android.app.MediaPlaybackActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { Intent intent;//from ww w . j ava2s . c o m try { switch (item.getItemId()) { case GOTO_START: intent = new Intent(); intent.setClass(this, MusicBrowserActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); break; case USE_AS_RINGTONE: { // Set the system setting to make this the current ringtone if (mService != null) { MusicUtils.setRingtone(this, mService.getAudioId()); } return true; } case PARTY_SHUFFLE: MusicUtils.togglePartyShuffle(); setShuffleButtonImage(); break; case NEW_PLAYLIST: { intent = new Intent(); intent.setClass(this, CreatePlaylist.class); startActivityForResult(intent, NEW_PLAYLIST); return true; } case PLAYLIST_SELECTED: { long[] list = new long[1]; list[0] = MusicUtils.getCurrentAudioId(); long playlist = item.getIntent().getLongExtra("playlist", 0); MusicUtils.addToPlaylist(this, list, playlist); return true; } case DELETE_ITEM: { if (mService != null) { long[] list = new long[1]; list[0] = MusicUtils.getCurrentAudioId(); Bundle b = new Bundle(); String f; if (android.os.Environment.isExternalStorageRemovable()) { f = getString(R.string.delete_song_desc, mService.getTrackName()); } else { f = getString(R.string.delete_song_desc_nosdcard, mService.getTrackName()); } b.putString("description", f); b.putLongArray("items", list); intent = new Intent(); intent.setClass(this, DeleteItems.class); intent.putExtras(b); startActivityForResult(intent, -1); } return true; } case EFFECTS_PANEL: { Intent i = new Intent(AudioEffect.ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL); i.putExtra(AudioEffect.EXTRA_AUDIO_SESSION, mService.getAudioSessionId()); startActivityForResult(i, EFFECTS_PANEL); return true; } } } catch (RemoteException ex) { } return super.onOptionsItemSelected(item); }
From source file:com.teleca.jamendo.activity.PlayerActivity.java
public void homeClickHandler(View target) { Intent intent = new Intent(this, HomeActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);/*from w ww .java2 s .c o m*/ finish(); }
From source file:br.com.viniciuscr.notification2android.mediaPlayer.MusicUtils.java
private static void playAll(Context context, long[] list, int position, boolean force_shuffle) { if (list.length == 0 || sService == null) { Log.d("MusicUtils", "attempt to play empty song list"); // Don't try to play empty playlists. Nothing good will come of it. // String message = context.getString(R.string.emptyplaylist, list.length); String message = "Lista vazia, Fdeu"; Toast.makeText(context, message, Toast.LENGTH_SHORT).show(); return;/*w w w. j a va2 s .co m*/ } if (force_shuffle) { sService.setShuffleMode(MediaPlaybackService.SHUFFLE_NORMAL); } long curid = sService.getAudioId(); int curpos = sService.getQueuePosition(); if (position != -1 && curpos == position && curid == list[position]) { // The selected file is the file that's currently playing; // figure out if we need to restart with a new playlist, // or just launch the playback activity. long[] playlist = sService.getQueue(); if (Arrays.equals(list, playlist)) { // we don't need to set a new list, but we should resume playback if needed sService.play(); return; // the 'finally' block will still run } } if (position < 0) { position = 0; } sService.open(list, force_shuffle ? -1 : position); sService.play(); Intent intent = new Intent("com.android.music.PLAYBACK_VIEWER").setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); context.startActivity(intent); }
From source file:com.android.calendar.event.EditEventView.java
@Override public void onClick(DialogInterface dialog, int which) { if (dialog == mNoCalendarsDialog) { mDone.setDoneCode(Utils.DONE_REVERT); mDone.run();//from w w w . j a va 2 s . c o m if (which == DialogInterface.BUTTON_POSITIVE) { Intent nextIntent = new Intent(Settings.ACTION_ADD_ACCOUNT); final String[] array = { "com.android.calendar" }; nextIntent.putExtra(Settings.EXTRA_AUTHORITIES, array); nextIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); mActivity.startActivity(nextIntent); } } }