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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:57:32+00:00 2026-06-16T17:57:32+00:00

I do totally agree with the Navigation below Imagine that the Book detail is

  • 0

I do totally agree with the Navigation below

enter image description here

Imagine that the Book detail is made in different instances of a BookDetailActivity.

The stack before pressing up in book2 detail is:

  • BookDetailActivity (Book 2 – You are here)
  • BookDetailActivity (Book 1)
  • AllBooksActivity

If I follow the guidelines I will use:

     Intent parentActivityIntent = new Intent(this, AllBooksActivity.class);
        parentActivityIntent.addFlags(
                Intent.FLAG_ACTIVITY_CLEAR_TOP |
                Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(parentActivityIntent);
        finish();

But the big problem with this code is that BookDetailActivity (Book 1) is still alive!

Pressing back button after “up” would bring the detail of Book 1.

How can I kill all the BookDetailActivity that are between the original AllBooksActivity and the activity where I pressed up?

  • 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-16T17:57:33+00:00Added an answer on June 16, 2026 at 5:57 pm

    The related guidelines article notes the following:

    Implementation Note: As a best practice, when implementing either Home
    or Up, make sure to clear the back stack of any descendent screens.
    For Home, the only remaining screen on the back stack should be the
    home screen. For Up navigation, the current screen should be removed
    from the back stack, unless Back navigates across screen hierarchies.
    You can use the FLAG_ACTIVITY_CLEAR_TOP and FLAG_ACTIVITY_NEW_TASK
    intent flags together to achieve this.

    Since you’re doing that, BookDetailActivity1 should be closed by FLAG_ACTIVITY_CLEAR_TOP. The only way if it could be alive and shown on pressing Back is if it would have been started before AllBooksActivity.

    As for not needing FLAG_ACTIVITY_NEW_TASK (suggested by android developer‘s answer):

    When using this flag, if a task is already running for the activity
    you are now starting, then a new activity will not be started;
    instead, the current task will simply be brought to the front of the
    screen with the state it was last in.

    …so if your activity exists, it will not start a new task.

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

Sidebar

Related Questions

Totally new to Capistrano. I have a local git repository that I want to
Totally confused here. I have a PARENT UIViewController that needs to pass an NSMutableArray
I have a few instances in my code where Style cop gives out that:
one totally useless question: I bought a numerical game, it's made of two black
In the book Programming in Scala, 2nd ed. , the authors write that writing
im totally new to rails. here my question: i made an app with articles
Totally new to custom control creation in Silverlight. I'm wanting a custom control that
I totally understand that in order to learn javascript I need to know how
Totally baffled! I've tried rewriting the text-decoration: none line several different ways. I also
Off late I'd been hearing that applications written in different languages can call each

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.