Do startActivity with the base intent of the activity. and if your activitys launch mode is singleTop, then your activity will be brought to front for sure.
- abthul On Thu, Jul 22, 2010 at 12:26 PM, Antti Karhu <antti.iisa...@gmail.com>wrote: > Hi! > > My app is having an Activity, and a local Service. The Service shows > notifications for time to time, and I like to open the Activity when the > notification is tapped. Now the problem is, I may get multiple activies > stacked if I tap the notifications many times in a row. Here's how I show > the notification: > > final NotificationManager notificationManager = (NotificationManager) > getSystemService(NOTIFICATION_SERVICE); > > Notification notification = new Notification(R.drawable.icon, "Hello", > System > .currentTimeMillis()); > > notification.flags |= Notification.FLAG_ONGOING_EVENT; > notification.flags |= Notification.FLAG_NO_CLEAR; > > Intent intent = new Intent(this, MyActivity.class); > intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT > | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); > PendingIntent i = PendingIntent.getActivity(this, 0, intent, 0); > > notification.setLatestEventInfo(this, "Hello", "Hello", i); > > notificationManager.notify(NOTIFICATION_ID, notification); > > Any suggestions how to just bring the Activity to the front if it already > exists? > > Br, > Antti > > -- > You received this message because you are subscribed to the Google > Groups "Android Beginners" group. > > NEW! Try asking and tagging your question on Stack Overflow at > http://stackoverflow.com/questions/tagged/android > > To unsubscribe from this group, send email to > android-beginners+unsubscr...@googlegroups.com<android-beginners%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-beginners?hl=en > -- With Regards Abthul Razeeth -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. NEW! Try asking and tagging your question on Stack Overflow at http://stackoverflow.com/questions/tagged/android To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en