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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T14:42:34+00:00 2026-05-28T14:42:34+00:00

I have an Android activity we’ll call A which has a button and another

  • 0

I have an Android activity we’ll call A which has a button and another activity B. When the user clicks the button in Activity A, I’d like to finish A (let both onStop and onDestroy finish running) and then start up the instance of B. When I put a finish() and startActivity() call in the button click listener, the instance of B starts up before the old instance of A finishes. Can someone help me figure out a way to do what I’m looking for?

  • 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-28T14:42:34+00:00Added an answer on May 28, 2026 at 2:42 pm

    What you are looking for is not possible and actually is against Android’s activity lifecycle implementation.

    Correction
    It is possible with android:noHistory="true" tag in your manifest, but for what you are trying to do it seems wrong (read the EDIT)… Messing with the activity stack makes a non intuitive application!

    Android OS doesn’t let you control when activities will be removed from memory (or killed), and therefore all these fancy "Task killers" are so popular (DONT use them, they only make things worse).
    When your activity’s onStop() is being called, the activity stops completely, and it just hangs in your memory, but that’s fine…

    If you want to reset the state of activity A, or close the app when exiting activity B, just create a set of rules in both onResume() and onStop(), you can do everything you wish by creating a set of rules in those functions.

    for example: have a boolean in activity A that turns true just before calling activity B,call finish() on your activity A‘s if this boolean is true

    I suggest that you take a look at Android’s Activity lifecycle diagram, and make sure that everything you do follows the best practice.

    EDIT

    I saw your comment, it seems like you are trying to create things that are already in your memory, don’t recreate them, it’s a waste of CPU time, memory, and battery.
    Instead, create a static class with a singleton that will hold all your shared data !

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

Sidebar

Related Questions

I have an android activity that needs to call another activity (to get a
I have a layout for an Android activity in which the second button is
I have an Android activity which has a header, some title text, and then
I have an Android activity which in turn starts a thread. In the thread
I have an android activity in which I'm using tabs. public class UnitActivity extends
I have an Android activity with an ImageButton. I would like to execute some
I have an Android activity that is largely transparent, much like a toast. However
I have an Android widget that has a configure activity. I also have an
I have an Android activity called main.java and BPMClass.java class. I need to call
I have an android Activity where I need to have the user enter some

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.