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.naddysworld.slingshot.Main.java
public void onActionBarItemSelected(View v) { // Example of how to handle action bar item selections. // Adjust, insert and/or remove case statements for your menu items // accordingly. switch (v.getId()) { // when app icon in action bar or action bar title is clicked, show // home/main activity case R.id.applicationIcon: case R.id.actionBarTitle: Intent intent = new Intent(this, com.naddysworld.slingshot.Main.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(intent);/* w w w. j a v a2s . c o m*/ break; case R.id.menuItem1: startActivity(new Intent(this, Preferences.class)); break; case R.id.menuItem2: SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); if (prefs.getString("username", "").equals("") || prefs.getString("password", "").equals("")) startActivity(new Intent(this, Preferences.class)); else new UpdateStationsTask().execute(); break; default: } }
From source file:br.com.awa.mylottery.gcm.MyGcmListenerService.java
/** * Create and show a simple notification containing the received GCM message. * * @param message GCM message received./*from w ww .ja v a 2 s .co m*/ */ private void sendNotification(String message) { Intent intent = new Intent(this, HomeActivity.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.common_ic_googleplayservices).setContentTitle("MyLottery") .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.wbs.itm.SelectedQuestionActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.all_ans);//from www. ja v a 2 s . com selquesList = new ArrayList<HashMap<String, String>>(); Intent newqestionintent = getIntent(); String newquestion = newqestionintent.getExtras().getString("TAG_QUESTION"); new LoadAllSelques().execute(); TextView text = (TextView) findViewById(R.id.selectedquestion); text.setText("Q. "); text.append(newquestion); ListView lv = getListView(); Button gohome = (Button) findViewById(R.id.gohome); gohome.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent i = new Intent(getApplicationContext(), TalkyLaunchActivity.class); i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); startActivity(i); } }); Button ansbtn = (Button) findViewById(R.id.ansbtn); ansbtn.setOnClickListener(new Button.OnClickListener() { @Override public void onClick(View v) { newqintent = getIntent(); newqid = newqintent.getExtras().getString("TAG_PID"); /*String newpid = ((TextView) findViewById(R.id.qid)).getText() .toString();*/ Intent mynewIntent = new Intent(SelectedQuestionActivity.this, NewAnswerActivity.class); mynewIntent.putExtra("TAG_newPID", newqid); SelectedQuestionActivity.this.startActivity(mynewIntent); } }); lv.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // getting values from selected ListItem // Do nothing! //Later on implement selective Replies. } }); }
From source file:com.fangyuan.vpngate.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_refresh: refresh();/*from w ww . j a v a2 s. com*/ break; case R.id.menu_setting: Intent intent = new Intent(this, SettingsActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); break; } return super.onOptionsItemSelected(item); }
From source file:com.ajay.developer.fcm.MyFirebaseMessagingService.java
/** * Create and show a simple notification containing the received FCM message. * * @param messageBody FCM message body received. *//*from ww w . j av a 2s. co m*/ private void sendNotification(String messageBody) { 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.ic_stat_ic_notification) .setContentTitle("FCM Message").setContentText(messageBody).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.allfirebasedemo.cloudmessagingpackage.MyFirebaseMessagingService.java
/** * Create and show a simple notification containing the received FCM message. * * @param messageBody FCM message body received. */// w w w. ja v a2s .c om private void sendNotification(String messageBody) { Intent intent = new Intent(this, MessagingActivity.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("FCM Message") .setContentText(messageBody).setAutoCancel(true).setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }
From source file:cn.ushang.myfire.MyFirebaseMessagingService.java
/** * Create and show a simple notification containing the received FCM message. * * @param messageBody FCM message body received. *//*w ww. j av a 2 s .c o m*/ private void sendNotification(String messageBody) { 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.mipmap.ic_stat_ic_notification).setContentTitle("FCM Message") .setContentText(messageBody).setAutoCancel(true).setSound(defaultSoundUri) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }
From source file:ar.fi.uba.jobify.service.MyFirebaseMessagingService.java
/** * Create and show a simple notification containing the received FCM message. * * @param messageBody FCM message body received. *//* w w w . j av a 2 s . com*/ private void sendNotification(String messageBody) { 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.ic_stat_ic_notification) .setContentTitle("FCM Message").setContentText(messageBody).setAutoCancel(true) .setSound(defaultSoundUri).setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); }
From source file:kaist.cs492c_2015.washerbrowser.MyGcmListenerService.java
/** * Create and show a simple notification containing the received GCM message. * * @param message GCM message received.// ww w . j av a2 s.com */ 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.ic_stat_ic_notification).setContentTitle("Find available washer") .setContentText(message).setAutoCancel(true).setSound(defaultSoundUri) .setVibrate(new long[] { 1000, 1000, 1000, 1000, 1000 }).setSmallIcon(R.drawable.washer_green) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build()); launchPopupActivity(this, message); }
From source file:edu.stanford.mobisocial.dungbeetle.GroupsActivity.java
/*** Dashbaord stuff ***/ public void goHome(Context context) { final Intent intent = new Intent(context, HomeActivity.class); if (Build.VERSION.SDK_INT < 11) intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); else/* w w w . j av a2 s. co m*/ intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }