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

The Archive Base Latest Questions

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

I have a some activities likr A-> Splash Screen B-> Home Screen C-> a

  • 0

I have a some activities likr

A-> Splash Screen
B-> Home Screen
C-> a List activity
D-> a View activty
E-> a List activity
F-> a View activty

Normaly application start with A -> B

Then user select a list activity

then user select a view from list activity.

my problem is clearing activty stack.

my application will jump list or view activity to an activity (with facefook style navigation)

For example user select a list activity C and than select view activity D. at hat point user can jump to acitivty E. When in activity E, if user press o back button, user go to the activity D.

I want that to go to the activty B(Home).

I mean ı want to clear activity stact without home activity.

how can ı do this ?.

sory for awasome English.

Thanks.

  • 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-04T17:13:14+00:00Added an answer on June 4, 2026 at 5:13 pm

    You can intercept the back button press like so:

    @Override
    public void onBackPressed() {
        // You want to start B Activity
        Intent a = new Intent(this, B.class);
    
        // But you dont want it on top of E.
        a.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    
        // Launching this will now remove every activity on top of B and bring B to front, not! relaunch it.
        startActivity(a);
    }
    

    You might want to check out the Android Intent flags and the Tasks and Back Stack Documentation.

    Have a nice day!

    EDIT:

    If you want to close your app when back is pressed:

    @Override
    public void onBackPressed() {
        moveTaskToBack(true);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some Activities, activity A in which I start new activity B in
I have some activities in my application. In main activity I have defined the
I have 3-4 activities in the application and all of them have some event
In my Android App I have a main activity and some other activities. The
My main activity is a TabActivity. I have some activities presented by the tab
My application have some activities which in the first one I connect a socket
In my PoC, I have some Activities, HomeActivity , CreateActivity , SearchActivity , ResultsActivity
I have a one main Workflow which calls several activities asynchronously. Some of the
I've got two Activities. In one I calculate some things and therefore I have
In my android application, I create shortcuts by code to some activities within my

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.