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.devspark.sidenavigation.meiriyiwen.MainActivity.java
private void invokeActivity2(String title, int resId) { Intent intent = new Intent(this, baseMenuActivity2.class); intent.putExtra(EXTRA_TITLE, title); intent.putExtra(EXTRA_RESOURCE_ID, resId); intent.putExtra(EXTRA_MODE, sideNavigationView.getMode() == Mode.LEFT ? 0 : 1); // all of the other activities on top of it will be closed and this // Intent will be delivered to the (now on top) old activity as a // new Intent. intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);/* w w w . j av a 2 s . c o m*/ // no animation of transition overridePendingTransition(0, 0); }
From source file:com.romanenco.gitt.BrowserActivity.java
private void deleteThisRepo() { AlertDialog dlg = new AlertDialog.Builder(this).setMessage(R.string.confirm_repo_delete) .setPositiveButton(getString(android.R.string.ok), new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { DAO dao = new DAO(BrowserActivity.this); dao.open(true);//from w ww. j a va 2s . com dao.delete(current.getFolder()); dao.close(); Intent delete = new Intent(BrowserActivity.this, GitService.class); delete.putExtra(GitService.COMMAND, GitService.Command.Delete); delete.putExtra(GitService.REPO, current); startService(delete); Intent main = new Intent(BrowserActivity.this, MainActivity.class); main.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(main); } }).setNegativeButton(getString(android.R.string.cancel), null).create(); dlg.setCanceledOnTouchOutside(false); dlg.show(); }
From source file:com.kiwiteam.nomiddleman.LargeGroupActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. switch (item.getItemId()) { case R.id.action_search: return true; case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; case R.id.home: Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);/*from w ww . j av a2s . c o m*/ return true; case R.id.action_cart: intent = new Intent(this, ShoppingCartActivity.class); startActivity(intent); return true; case R.id.account: account(); return true; case R.id.signout: conn.signout(); recreate(); return true; } return super.onOptionsItemSelected(item); }
From source file:at.maui.cheapcast.service.CheapCastService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.d(LOG_TAG, "onStartCommand()"); Notification n = null;/* ww w .ja v a 2s .c om*/ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { Notification.Builder mBuilder = new Notification.Builder(this).setSmallIcon(R.drawable.ic_service) .setContentTitle("CheapCast").setContentText("Service enabled.").setOngoing(true) .addAction(R.drawable.ic_reload, getString(R.string.restart_service), PendingIntent.getBroadcast(this, 1, new Intent(Const.ACTION_RESTART), PendingIntent.FLAG_ONE_SHOT)) .addAction(R.drawable.ic_stop, getString(R.string.stop_service), PendingIntent .getBroadcast(this, 2, new Intent(Const.ACTION_STOP), PendingIntent.FLAG_ONE_SHOT)); Intent i = new Intent(this, PreferenceActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0); mBuilder.setContentIntent(pi); n = mBuilder.build(); } else { Intent i = new Intent(this, PreferenceActivity.class); i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent pi = PendingIntent.getActivity(this, 0, i, 0); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_service).setContentTitle("CheapCast") .setContentText("Service enabled.").setOngoing(true).setContentIntent(pi); n = mBuilder.getNotification(); } startForeground(1337, n); if (!mRunning) initService(); return START_STICKY; }
From source file:com.onesignal.GenerateNotification.java
private static Intent getNewBaseIntent(int notificationId) { Intent intent = new Intent(currentContext, notificationOpenedClass).putExtra("notificationId", notificationId);/*from w w w . j a v a2 s. co m*/ if (openerIsBroadcast) return intent; return intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); }
From source file:com.joefernandez.irrduino.android.remote.IrrduinoRemoteActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { final Intent intent; // Handle item selection switch (item.getItemId()) { case R.id.preferences: intent = new Intent(this, Settings.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);// w w w . ja v a 2 s . c o m settingsChanged = true; return true; case R.id.report: intent = new Intent(this, ViewReportActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.capstonecontrol.AccountsActivity.java
/** * Sets up the 'disconnected' screen./*from ww w . ja va 2 s . co m*/ */ private void setDisconnectScreenContent() { final SharedPreferences prefs = Util.getSharedPreferences(mContext); String accountName = prefs.getString(Util.ACCOUNT_NAME, "Unknown"); // Format the disconnect message with the currently connected account // name TextView disconnectText = (TextView) findViewById(R.id.disconnect_text); String message = getResources().getString(R.string.disconnect_text); String formatted = String.format(message, accountName); disconnectText.setText(formatted); final Button disconnectButton = (Button) findViewById(R.id.disconnect); disconnectButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { // Unregister C2DMessaging.unregister(mContext); // clear the module list so that a new one will get found CapstoneControlActivity.modules.clear(); // instead of finish() go back to the AccountsActivity for // new login. CapstoneControlActivity.userChanged = true; Intent myIntent = new Intent(v.getContext(), SplashActivity.class); startActivity(myIntent); myIntent = new Intent(v.getContext(), CapstoneControlActivity.class); startActivity(myIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)); } }); }
From source file:edu.polyu.screamalert.SoundProcessing.java
@SuppressWarnings("unchecked") public static void initialize(Context context) { thisContext = context;//from w w w . j av a 2 s. com x = new float[samplePerFrm]; subx = new float[frameShift]; // Samples in a sub-frame mfcc = new MFCC(samplePerFrm, Config.RECORDER_SAMPLERATE, numMfcc); ccBuf = new CircularFifoBuffer(K); // Buffer storing K mfcc vectors dccBuf = new CircularFifoBuffer(K); // Buffer storing K delta-mfcc vectors pDet = new YinPitchDetector(Config.RECORDER_SAMPLERATE, samplePerFrm); piBuf = new CircularFifoBuffer(K); pkBuf = new CircularFifoBuffer(K); mu_z = new double[] { VoiceQuality.JITTER_MEAN, VoiceQuality.SHIMMER_MEAN }; // Jitter and shimmer mean sigma_z = new double[] { VoiceQuality.JITTER_STD, VoiceQuality.SHIMMER_STD }; // Jitter and shimmer stddev aList = new ArrayList<double[]>(); enBuf = new CircularFifoBuffer(enBufSize); // Circular buffer storing energy profile of the latest K frames frmBuf = new CircularFifoBuffer(K); // Buffer storing K latest frames of audio signals */ for (int k = 0; k < K; k++) { ccBuf.add(new double[numMfcc + 1]); // Initialize MFCC FIFO buffers dccBuf.add(new double[numMfcc + 1]); // Initialize delta MFCC FIFO buffers piBuf.add(-1.0D); // Initialize pitch FIFO buffer for computing jitter and shimmer pkBuf.add(0.0D); // Initialize peak amplitude FIFO buffer for computing shimmer frmBuf.add(new double[samplePerFrm]); // Initialize frame buffer } for (int k = 0; k < enBufSize; k++) { enBuf.add(new double[1]); // Initialize energy buffer } mainIntent = new Intent(thisContext, SoundProcessingSetting.class); mainIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); pIntent = PendingIntent.getActivity(thisContext, 0, mainIntent, 0); // Go back to MainActivity when user press the notification noti = new NotificationCompat.Builder(thisContext) .setContentTitle( thisContext.getString(R.string.app_name) + " " + thisContext.getString(R.string.running)) .setContentText(thisContext.getString(R.string.configure)).setSmallIcon(R.drawable.ic_launcher) .setContentIntent(pIntent).build(); noti.flags = Notification.FLAG_FOREGROUND_SERVICE; if (SoundProcessingActivity.thisActivity == null) calibrateDialog = new ProgressDialog(Exchanger.thisContext); else calibrateDialog = new ProgressDialog(SoundProcessingActivity.thisActivity); }
From source file:com.airbop.client.GCMIntentService.java
private static void generateNotification(Context context, String title, String message, String url, String large_icon) {/* w w w .j a v a 2 s .com*/ int icon = R.drawable.ic_stat_gcm; long when = System.currentTimeMillis(); NotificationManager notificationManager = (NotificationManager) context .getSystemService(Context.NOTIFICATION_SERVICE); if ((title == null) || (title.equals(""))) { title = context.getString(R.string.app_name); } Intent notificationIntent = null; if ((url == null) || (url.equals(""))) { //just bring up the app notificationIntent = new Intent(context, DemoActivity.class); } else { //Launch the URL notificationIntent = new Intent(Intent.ACTION_VIEW); notificationIntent.setData(Uri.parse(url)); notificationIntent.addCategory(Intent.CATEGORY_BROWSABLE); } // set intent so it does not start a new activity notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP); PendingIntent intent = PendingIntent.getActivity(context, 0, notificationIntent, 0); Notification notification = new NotificationCompat.Builder(context).setContentTitle(title) .setContentText(message).setContentIntent(intent).setSmallIcon(icon) .setLargeIcon(decodeImage(large_icon)).setWhen(when) .setStyle(new NotificationCompat.BigTextStyle().bigText(message)).build(); notification.flags |= Notification.FLAG_AUTO_CANCEL; notificationManager.notify(0, notification); }
From source file:com.andremion.louvre.preview.PreviewActivity.java
@Nullable @Override// w ww.j av a2 s . c o m public Intent getSupportParentActivityIntent() { //noinspection ConstantConditions return super.getSupportParentActivityIntent().addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); }