List of usage examples for android.content Intent FLAG_ACTIVITY_REORDER_TO_FRONT
int FLAG_ACTIVITY_REORDER_TO_FRONT
To view the source code for android.content Intent FLAG_ACTIVITY_REORDER_TO_FRONT.
Click Source Link
From source file:ufms.br.com.ufmsapp.activity.NotasAtividadesActivity.java
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent parentIntent = NavUtils.getParentActivityIntent(this); parentIntent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(parentIntent);/*from w ww . j ava 2 s .c o m*/ supportFinishAfterTransition(); break; case R.id.action_desempenho: Intent intent = new Intent(this, GraficosActivity.class); intent.putExtra(DISCIPLINA_EXTRA, disciplina); startActivity(intent); break; //return true; } return super.onOptionsItemSelected(item); }
From source file:org.envirocar.app.application.service.DeviceInRangeService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { logger.info("onStartCommand " + getClass().getName() + "; Hash: " + System.identityHashCode(this)); discoveryEnabled = true;/* w ww. j a v a2 s .c o m*/ startWithDelay(0); PendingIntent pIntent = PendingIntent.getActivity(this, 0, new Intent(this, MainActivity.class), Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); Notification note = new NotificationCompat.Builder(getApplicationContext()) .setSmallIcon(R.drawable.dashboard).setContentTitle("enviroCar").setContentIntent(pIntent) .setContentText(getResources().getText(R.string.device_discovery_pending)).build(); startForeground(BackgroundServiceImpl.BG_NOTIFICATION_ID, note); return super.onStartCommand(intent, flags, startId); }
From source file:ufms.br.com.ufmsapp.activity.DetalhesDisciplinaActivity.java
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent parentIntent = NavUtils.getParentActivityIntent(this); parentIntent.setFlags(Intent.FLAG_ACTIVITY_BROUGHT_TO_FRONT | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(parentIntent);//from www . j a v a 2s. co m supportFinishAfterTransition(); return true; } return super.onOptionsItemSelected(item); }
From source file:com.apotheosis.acceleration.monitor.MainMenuActivity.java
private void startCollection(String name) { collector.setFileName(name);//w w w .j a v a2s . co m collector.start(); pauseAccel.setText("Finish"); if (getSupportActionBar() != null) getSupportActionBar().setTitle("Data Collection In Progress"); NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); NotificationCompat.Builder notification = new NotificationCompat.Builder(MainMenuActivity.this); notification.setSmallIcon(R.drawable.ic_launcher); notification.setContentTitle("Acceleration Monitor"); notification.setContentText("Data Collection in Progress"); Intent pendingIntent = new Intent(MainMenuActivity.this, MainMenuActivity.class); pendingIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); PendingIntent contentIntent = PendingIntent.getActivity(MainMenuActivity.this, 0, pendingIntent, 0); notification.setContentIntent(contentIntent); notification.setOngoing(true); nm.notify(R.string.app_name, notification.build()); }
From source file:org.catrobat.paintroid.WelcomeActivity.java
private void launchHomeScreen() { session.setFirstTimeLaunch(false);//from w w w. jav a 2s. c o m Intent mainActivityIntent = new Intent(WelcomeActivity.this, MainActivity.class); mainActivityIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(mainActivityIntent); finish(); }
From source file:net.xisberto.work_schedule.alarm.AlarmMessageActivity.java
private void showNotification() { Intent alarmIntent = new Intent(this, AlarmMessageActivity.class); alarmIntent.setAction(AlarmMessageActivity.ACTION_SHOW_ALARM); alarmIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS); PendingIntent alarmSender = PendingIntent.getActivity(this, period.getId(), alarmIntent, PendingIntent.FLAG_CANCEL_CURRENT); Intent dismissIntent = new Intent(this, AlarmMessageActivity.class) .setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT).setAction(ACTION_DISMISS_ALARM); PendingIntent dismissSender = PendingIntent.getActivity(this, REQ_DISMISS, dismissIntent, PendingIntent.FLAG_CANCEL_CURRENT); Intent snoozeIntent = new Intent(this, AlarmMessageActivity.class) .setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT).setAction(ACTION_SNOOZE_ALARM); PendingIntent snoozeSender = PendingIntent.getActivity(this, REQ_SNOOZE, snoozeIntent, PendingIntent.FLAG_CANCEL_CURRENT); NotificationManager nm = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_stat_notification).setContentTitle(this.getString(period.getLabelId())) .setTicker(this.getString(period.getLabelId())).setWhen(period.time.getTimeInMillis()) .setOngoing(false).setOnlyAlertOnce(true).setContentIntent(alarmSender) .setDeleteIntent(dismissSender) .addAction(R.drawable.ic_snooze, getString(R.string.snooze), snoozeSender) .addAction(R.drawable.ic_dismiss, getString(R.string.dismiss), dismissSender).build(); nm.notify(period.getId(), notification); }
From source file:com.inovex.zabbixmobile.activities.BaseActivity.java
@Override public boolean onNavigationItemSelected(MenuItem menuItem) { Intent intent;//w w w .j av a2s. co m if (menuItem.isChecked()) menuItem.setChecked(false); else menuItem.setChecked(true); if (mServerSelectMode) { selectServerItem(menuItem.getItemId()); toggleServerSelectionMode(); return true; } //Closing drawer on item click switch (menuItem.getItemId()) { case R.id.navigation_item_problems: intent = new Intent(this, ProblemsActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); mDrawerLayout.closeDrawers(); break; case R.id.navigation_item_events: intent = new Intent(this, EventsActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); mDrawerLayout.closeDrawers(); break; case R.id.navigation_item_checks: intent = new Intent(this, ChecksActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); mDrawerLayout.closeDrawers(); break; case R.id.navigation_item_screens: intent = new Intent(this, ScreensActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); mDrawerLayout.closeDrawers(); break; case R.id.navigation_settings: intent = new Intent(this, ZaxPreferenceActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivityForResult(intent, REQUEST_CODE_PREFERENCES); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); return true; case R.id.navigation_manage_servers: intent = new Intent(this, ServersActivity.class); break; case R.id.navigation_info: intent = new Intent(this, InfoActivity.class); break; default: return true; } startActivity(intent); overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out); // update selected item and title, then close the drawer //mDrawerFragment.selectMenuItem(position); return true; }
From source file:org.envirocar.app.application.service.BackgroundServiceImpl.java
private void createForegroundNotification(int stringResource) { CharSequence string = getResources().getText(stringResource); Intent intent = new Intent(this, MainActivity.class); PendingIntent pIntent = PendingIntent.getActivity(this, 0, intent, Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); Notification note = new NotificationCompat.Builder(getApplicationContext()).setContentTitle("enviroCar") .setContentText(string).setContentIntent(pIntent).setSmallIcon(R.drawable.dashboard).build(); note.flags |= Notification.FLAG_NO_CLEAR; startForeground(BG_NOTIFICATION_ID, note); }
From source file:cz.muni.fi.japanesedictionary.main.DisplayTranslationActivity.java
/** * Listener for menu item selected./*from w ww . j a v a 2 s.c om*/ * * @param item - home item selected, restarts main activity * - settings item selceted, launches new MypreferenceActivity * - other item, default behavior */ @Override public boolean onOptionsItemSelected(MenuItem item) { mDrawerLayout.closeDrawer(mDrawerList); if (mDrawerToggle.onOptionsItemSelected(item)) { return true; } switch (item.getItemId()) { case R.id.settings: Log.i(LOG_TAG, "Lauching preference Activity"); Intent intentSetting = new Intent(this.getApplicationContext(), cz.muni.fi.japanesedictionary.main.MyPreferencesActivity.class); intentSetting.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intentSetting); return true; case R.id.about: Log.i(LOG_TAG, "Lauching About Activity"); Intent intentAbout = new Intent(this.getApplicationContext(), cz.muni.fi.japanesedictionary.main.AboutActivity.class); intentAbout.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); startActivity(intentAbout); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.pomelodesign.cordova.metaio.MetaioPlugin.java
@Override public boolean execute(String action, JSONArray args, final CallbackContext callbackContext) throws JSONException { if (action.equals("open")) { MetaioDebug.log("Metaio open..."); try {/*from w w w . j ava 2 s . com*/ cordova.getActivity().runOnUiThread(new Runnable() { public void run() { if (mTask == null) { mTask = new AssetsExtracter(); mTask.execute(0); } else { mTask.onPostExecute(true); } callbackContext.success(); } }); loaded = true; return true; } catch (Exception e) { MetaioDebug.log(Log.ERROR, "Error opening metaio: " + e.getMessage()); MetaioDebug.printStackTrace(Log.ERROR, e); callbackContext.error("Error opening metaio"); return false; } } else if (action.compareTo("destroy") == 0) { MetaioDebug.log("Metaio destroy..."); try { if (loaded == true) { cordova.getActivity().runOnUiThread(new Runnable() { public void run() { ARELViewActivity.removeARELView(); loaded = false; callbackContext.success(); } }); return true; } callbackContext.error("Error detroying metaio, metaio not loaded"); return true; } catch (Exception e) { MetaioDebug.log(Log.ERROR, "Error destroying metaio: " + e.getMessage()); MetaioDebug.printStackTrace(Log.ERROR, e); callbackContext.error("Error detroying metaio"); return false; } } else if (action.compareTo("close") == 0) { MetaioDebug.log("Metaio close..."); try { if (cordovaIntent == null) { cordovaIntent = new Intent(MetaioPlugin.getContext().getApplicationContext(), this.cordova.getClass()); } cordovaIntent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT); MetaioPlugin.getContext().startActivity(cordovaIntent); Url = args.getString(0); cordova.getActivity().runOnUiThread(new Runnable() { public void run() { String url = Url; if (url != null && url.length() > 0 && url.compareTo("null") != 0) { mPlugin.webView .loadUrl("javascript:cordova.fireDocumentEvent('metaioclose', { 'detail': '" + url + "' })"); } else { mPlugin.webView.loadUrl("javascript:cordova.fireDocumentEvent('metaioclose')"); } } }); callbackContext.success(); return true; } catch (Exception e) { MetaioDebug.log(Log.ERROR, "Error hiding metaio: " + e.getMessage()); MetaioDebug.printStackTrace(Log.ERROR, e); callbackContext.error("Error closing metaio"); return false; } } return false; }