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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T08:35:17+00:00 2026-06-11T08:35:17+00:00

My question is little bit different than these type of question. I need to

  • 0

My question is little bit different than these type of question. I need to remove or clear my activity stack then start a new activity. I don’t think it is a clear_top flag problem. I am explaining with an example:

My Activity flow :

Login > Home > Screen1 > screen2 ....

I finish Login activity or call with no_history flag. So my activities are look like this

Login(finished)> Home [bottom of the stack now] > Screen1 > Screen2[top of the stack]

I need to handle session error. If any session error occurs in any point i need to go back to login activity. But remember i don’t have login activity in stack. So clear_top will not work.

If any session error occurs in Screen2 then i need to clear full stack (screen2, screen1, home) and then start login activity. So that after back button press in login activity will close my apps.

Is there any way to clear the activity stack?

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-11T08:35:19+00:00Added an answer on June 11, 2026 at 8:35 am

    Use this

    Intent i = new Intent(yourScreen.this,Home.class);
            i.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
            i.putExtra("EXIT", true);
            startActivity(i);
    

    and in the onCreate of the Home class, do this to check,

    if (getIntent().getBooleanExtra("EXIT", false)) 
        {
            Intent i = new Intent(Home.this,Login.class);
            startActivity(i);
            finish();
        }
    

    what this will essentially do is no matter at what activity you are, you can call the home screen with the clear top flag. In the home screen there is a check condition in the onCreate method which will help to clear the stack and take you to the login screen.. Now on the login screen,if you press back button you will exit the app as the stack is cleared..

    Let me know if the problem still persists…

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

Sidebar

Related Questions

A bit more specific than Stack Overflow question What is an existential type? ,
It is look like same question but mine little bit different. Entity Framework 4
My question might be little bit different or basic for advanced users here. I
I have little bit longer question for you - but hope answer will be
This question may seem a little bit stackoverflow-implementation specific, but I have seen a
My question may sound a little bit stupid. My team has to test a
This might be a little bit odd question, but Im trying to figure out
I have little question. I found this on internet: Type t = typeof(MyClass); MethodInfo[]
I'm currently creating a website a little bit like Digg.com. There are different category
My situation is a little bit different, I'm using CKEditor for both editing and

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.