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:biz.atelecom.communicator.MyGcmListenerService.java
private void sendNotification(Bundle data) { //Intent intent = new Intent(this, ChatActivity.class); Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtras(data);//from w w w . j av a2 s .c o m PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.atelecom_ic_notification).setContentTitle("Atelecom Message") .setContentText("message").setAutoCancel(true).setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }
From source file:bhtech.com.cabbydriver.services.MyGcmListenerService.java
private void sendNotification(String message) { Intent intent = new Intent(this, ChooseRouteToCustomerController.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) //.setSmallIcon(R.drawable.ic_stat_ic_notification) .setContentTitle("GCM Message").setContentText(message).setAutoCancel(true) .setSound(defaultSoundUri).setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }
From source file:com.manning.androidhacks.hack046.helper.NotificationHelper.java
private static PendingIntent getReplyPendingIntent(Context ctx) { Intent intent = new Intent(ctx, ReplyActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); return PendingIntent.getActivity(ctx, 0, intent, 0); }
From source file:com.midisheetmusicmemo.ChooseSongActivity.java
@Override public void onCreate(Bundle state) { globalActivity = this; TommyConfig.init(this); super.onCreate(state); Bitmap allFilesIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.allfilesicon); Bitmap recentFilesIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.recentfilesicon); Bitmap browseFilesIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.browsefilesicon); final TabHost tabHost = getTabHost(); tabHost.addTab(tabHost.newTabSpec("All").setIndicator("All", new BitmapDrawable(allFilesIcon)) .setContent(new Intent(this, AllSongsActivity.class))); tabHost.addTab(tabHost.newTabSpec("Recent").setIndicator("Recent", new BitmapDrawable(recentFilesIcon)) .setContent(new Intent(this, RecentSongsActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))); tabHost.addTab(tabHost.newTabSpec("Browse").setIndicator("Browse", new BitmapDrawable(browseFilesIcon)) .setContent(new Intent(this, FileBrowserActivity.class))); }
From source file:chat.rocket.app.gcm.GCMListenerService.java
/** * Create and show a simple notification containing the received GCM message. * * @param message GCM message received./* w w w .j a va 2 s .c o m*/ */ private void sendNotification(String message) { Intent intent = new Intent(this, SplashActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.mipmap.ic_launcher).setContentTitle(getString(R.string.app_name)) .setContentText(message).setAutoCancel(true).setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }
From source file:com.android.screenspeak.contextmenu.ContextMenuItemClickProcessor.java
public boolean onMenuItemClicked(MenuItem menuItem) { if (menuItem == null) { // Let the manager handle cancellations. return false; }//from ww w .ja va 2 s. c o m final int itemId = menuItem.getItemId(); if (itemId == R.id.read_from_top) { mService.getFullScreenReadController().startReadingFromBeginning(); } else if (itemId == R.id.read_from_current) { mService.getFullScreenReadController().startReadingFromNextNode(); } else if (itemId == R.id.repeat_last_utterance) { mService.getSpeechController().repeatLastUtterance(); } else if (itemId == R.id.spell_last_utterance) { mService.getSpeechController().spellLastUtterance(); } else if (itemId == R.id.pause_feedback) { mService.requestSuspendScreenSpeak(); } else if (itemId == R.id.screenspeak_settings) { final Intent settingsIntent = new Intent(mService, ScreenSpeakPreferencesActivity.class); settingsIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); settingsIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); mService.startActivity(settingsIntent); } else if (itemId == R.id.tts_settings) { Intent intent = new Intent(); intent.setAction("com.android.settings.TTS_SETTINGS"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); mService.startActivity(intent); } else { // The menu item was not recognized. return false; } // Broadcast a notification that a menu item was clicked. Intent intent = new Intent(ContextMenuMonitor.ACTION_CONTEXT_MENU_ITEM_CLICKED); intent.putExtra(ContextMenuMonitor.EXTRA_ITEM_ID, itemId); LocalBroadcastManager.getInstance(mService).sendBroadcast(intent); return true; }
From source file:com.airflo.preferences.FilePreferenceActivity.java
public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: if (fragment.tryToMoveUp()) return true; Intent intent = new Intent(this, FlightListActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); //Resume saved State! NavUtils.navigateUpTo(this, intent); return true; }//from w w w.j a v a 2s .c o m return super.onOptionsItemSelected(item); }
From source file:be.thomasave.executeorder42.MyGcmListenerService.java
/** * Create and show a simple notification containing the received GCM message. * * @param message GCM message received.//from w ww. j av a 2s . c o m */ private void sendNotification(String message) { Intent intent = new Intent(this, MainActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.icon).setContentTitle("Execute Order 42").setContentText(message) .setAutoCancel(true).setSound(defaultSoundUri).setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }
From source file:com.android.utils.labeling.LabelOperationUtils.java
public static boolean startActivityEditLabel(Context context, Label label) { if (context == null || label == null) { return false; }// ww w . ja v a 2 s . co m final Intent editIntent = new Intent(ACTION_EDIT_LABEL); final Bundle extras = new Bundle(); extras.putLong(EXTRA_LONG_LABEL_ID, label.getId()); editIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); editIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); editIntent.putExtras(extras); try { context.startActivity(editIntent); return true; } catch (Exception e) { e.printStackTrace(); return false; } }
From source file:bhtech.com.cabbytaxi.services.MyGcmListenerService.java
/** * Create and show a simple notification containing the received GCM message. * * @param message GCM message received./*from w w w . ja va 2 s. co m*/ */ private void sendNotification(String message) { Intent intent = new Intent(this, FindTaxiController.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("message", message); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* Request code */, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) //.setSmallIcon(R.drawable.ic_stat_ic_notification) .setContentTitle("GCM Message").setContentText(message).setAutoCancel(true) //.setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }