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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:40:02+00:00 2026-06-13T09:40:02+00:00

I want to clear the backstack when I start new Activity intent. The exact

  • 0

I want to clear the backstack when I start new Activity intent.

The exact case of my problem is as following:
I have activities like this A > B > C > D > E
“A” is a registration activity and “B” is a confirm registration activity. I want that when user start activity “B” that he can’t back to activity “A” anymore, also when user reach activity “C”, both activity “A” and “B” would be useless, I don’t need user back to them anymore.

Also when user moves to activity “D” from “C”, he can get back to “C” but if he moved further to “E” activity, he can’t get back to any of the previous “C” or “D” activities.

After a lot of research, the best I got is to use flag: FLAG_ACTIVITY_NO_HISTORY, But it has two problems for my case:

  1. At activity “A” if user navigate away from my application (for example to home screen), it destroy that activity and hence all information that user entered is lost!
  2. Activity “C” I want keep it in history (backstack) if while user navigate to “D” activity but when user move to “E” activity I want remove it.

I can’t find a solution for this problem till now, I think it would be easier if there something to clear the backstack of current task!

My minimum SDK support is 5.

Thanks in advance.

  • 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-13T09:40:03+00:00Added an answer on June 13, 2026 at 9:40 am

    If you are using API level 11 or higher you can simply add the FLAG_ACTIVITY_CLEAR_TASK on your intent, which will clear all the other activities in your task.

    Otherwise, this might help:
    Clearing the full Android activity stack on older SDKs (that lack FLAG_ACTIVITY_CLEAR_TASK)

    Another approach, would be for you to finish the activities you no longer want the user to be able to return to.
    For instance, if you call ActivityA.finish() before moving to B, the activity will be removed from the task.

    When you start the activity D, you can start it using startActivityForResult() from C, and when you close D, send the result to C, and then finish activity C before navigating to E.

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

Sidebar

Related Questions

I have a STE and I want to clear navigation property collection like customer.Orders.Clear().
I'm reading Metaprogramming Ruby and just want to clear something up about the following
I have a slightly theoretical question that I want to clear up before I
Let's say I have 10 breakpoints and I want to clear one but not
I want to clear my understanding about the following command : Yii::app()->db->getLastInsertId() ; Does
I have groupbox I want to clear all the control in it , I
I have a global variable int[] and I want to clear its data and
I have a layout problem, I want an image to be in the middle
I just want to clear the selection of a html selectbox. The following works
I have an ashx handler and want to clear the session on request. I

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.