Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8771583
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:49:34+00:00 2026-06-13T17:49:34+00:00

I have a notification in my app and I want it to bring back

  • 0

I have a notification in my app and I want it to bring back an existing activity when the user clicks it.
The notification is genereated within the activity I want to bring back so I assume it still exists.

This is my code for the notification:

NotificationManager nm = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    Notification noti = new Notification(R.drawable.icon, "s", 0);
    CharSequence title = "S";
    CharSequence details = "W";
    Intent intent = new Intent(getBaseContext(), Start.class);
    intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
    PendingIntent pending = PendingIntent.getActivity(getBaseContext(), 0, intent, 0);
    noti.setLatestEventInfo(Start.this, title, details, pending);
    nm.notify(0,noti);

But for some reason it keeps creating a new activity.
what am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:49:35+00:00Added an answer on June 13, 2026 at 5:49 pm

    “The notification is genereated within the activity I want to bring back so I assume it still exists.” Well, it may, but it’s not generally a good idea for you to count on that. What if the user clicks on the notification only after backing out of your app using the back button, or after some length of time during which the OS has killed your activity while the user has been doing other things? Is there a particular reason why you need the “old” activity? If it has a state that you need to preserve or recreate, you can do that: have a look at http://developer.android.com/training/basics/activity-lifecycle/recreating.html and http://developer.android.com/guide/components/activities.html#SavingActivityState.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a music stream app and I want to display a foreground notification
In my app I want to have an alarm/notification on Ringer & Alert Volume
i want implement geolocation notification like the app reminders. this is what i have
I have built a simple Notification system in my Cake app that I want
In my app I have a notification in the task bar and when clicked
I have a click-once deployed app that uses a notification icon created using the
I am working on an iPhone app with Apple Push Notification integration. I have
1/I don't want to notify user if this one is already running my app
I have a new earthquake notification android app thats in it's initial release version.
I have an app start by Splash activity screen for 5 seconds Then open

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.