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 6891593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:25:47+00:00 2026-05-27T06:25:47+00:00

I managed to get a notification from our app to appear on the Notification

  • 0

I managed to get a notification from our app to appear on the Notification bar at the top of the screen, whenever it receives a push. My application is a hierarchy of views. I have my main screen with a listview. When one of these listview items is clicked it opens a summary screen (also containing a listview), and when one of the summary screen listview items is clicked it opens a details screen (last screen in the hierarchy). The user can hit the back button to travel back up the hierarchy to the main screen (or home screen).

Now, my application, and most apps for that matter, tend to run in the background until the back button is hit enough times. I set my Notification to launch an instance of mainScreen when it is clicked. The thing is if the app is already running and I do this it creates another main screen over all the other screens, so when the user hits the back button on the main screen (expecting to exit out of the app) he’ll go back to whatever screen was active when he left my app running in the background.

So, I could potentially go back up the hierarchy like this:
mainScreen -> detailsScreen -> summaryScreen -> mainScreen -> EXIT

Is there a way I can just kill the application and start a fresh instance when the user clicks my notification? How are these notification clicks normally handled?

Hope this makes sense.

Thanks.

(Edtied: Got everything working as expected except for one problem. I wasn’t completely honest when I said that the detailsScreen(activityB in your example) was the last in the hierarchy. On this screen the user actually has the option to view a map

Intent intent = new Intent(android.content.Intent.ACTION_VIEW, 
                Uri.parse("geo:0,0?q=" + depLatitude + "," + depLongitude + "(" + name + ")"));
                startActivity(intent);

When I press back on the map, the ideal situation would be for it to return to the detailsScreen, but in this case it goes right back to the mainScreen.

Any ideas?
)

  • 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-05-27T06:25:48+00:00Added an answer on May 27, 2026 at 6:25 am

    You can use Reorder to front attribute and get the same instance of mainScreen to the top.
    For destroying activities which you dont want as soon as they go in the background use noHistory attribute

    MainActivity → Activity A → Activity B → Activity A
    

    Launch Activity A from MainActivity

    Intent intentA = new Intent(MainActivity.this, ActivityA.class);
    startActivity(intentA);
    

    In this code snippet we are launching Activity A in the standard mode.

    Launch Activity B from Activity A

    Activity B is launched with Intent flag : Intent.FLAG_ACTIVITY_REORDER_TO_FRONT from Activity A

    Intent intentB = new Intent(ActivityA.this, ActivityB.class);
    intentB.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
    startActivity(intentB);
    

    Launch Activity A from Activity B

    When the Activity A is launched from Activity B the previous instance of the activity gets reordered to the front instead of creating a new one

    Intent intentA = new Intent(MainActivity.this, ActivityA.class);
    startActivity(intentA);
    

    No History

    <activity android:noHistory="true" ../>
    

    Whether or not the activity should be removed from the activity stack and finished (its finish() method called) when the user navigates away from it and it’s no longer visible on screen — “true” if it should be finished, and “false” if not. The default value is “false”.
    A value of “true” means that the activity will not leave a historical trace. It will not remain in the activity stack for the task, so the user will not be able to return to it.

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

Sidebar

Related Questions

I managed to get some help from a previous question and I have the
I managed to get authentication to work by following the tutorial from this page
I've managed to get a memory 'leak' in a java application I'm developing. When
Whenever I try uploading to a device from MonoTouch, I get the following console
I am trying to install django-notification app[1] and I get an error when I
Basically I'm trying to get the notifications present in the notification bar somewhere else,
I managed to get the YUI calendar widget working fine. But When it displays
I managed to get a unsigned long int octets-representation (BE) by reading IPv4 methods,
I've somehow managed to get an SVN repository into a bad state. I've moved
Have you managed to get Aptana Studio debugging to work? I tried following this,

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.