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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:37:08+00:00 2026-05-25T21:37:08+00:00

The books I have are abysmal at explaining how to work with the lifecycle,

  • 0

The books I have are abysmal at explaining how to work with the lifecycle, there’s a lot I’m missing that I’m hoping somebody can fill in.

My app structure is that when it’s first started, it starts an activity full of legalbabble that the user has to accept. When he says ‘ok’, I start my main activity and then I call finish like this:

public void onClick(View view) { //as a result of "I accept"
    Intent mainIntent = new Intent(mParent, EtMain.class);
    startActivity(mainIntent); // Start the main program
    finish();
}

Then in EtMain in the onCreate method, I’ve got some tabs and I instantiate some classes:

super.onCreate(savedInstanceState);
setContentView(R.layout.main);

mTabHost = (TabHost)findViewById(android.R.id.tabhost);
SetupTabs.setMyTabs(mTabHost, this);

mComData = new ComFields(this); // Create the objects
mDepWx = new WxFields(this, DepArr.Departure);
mArrWx = new WxFields(this, DepArr.Arrival);
mDepVs = new DepFields(this);
mArrVs = new ArrFields(this);
mTabHost.setOnTabChangedListener(new OnTabChangeListener(){
}

Questions:
The ‘finish’ in the first fragment should terminate the legalbabble activity so it’ll never be restarted, right? And the EtMain one will remain forever (until killed externally), even if my app gets pushed to the background, right?

The way it is now, when EtMain gets pushed and later brought to the foreground (by tapping on the icon), it goes through the legalbabble screen as though it’s a complete start – that’s what I’d like to prevent – going thru the legalbabble screen again.

It would seem that I’d want to override onRestart in the second code fragment and put something in there to restart the app, right? That’s the part I’m unclear about.

My question then is what needs to be done in onRestart. Do I have to recreate all the tabs and data in the tabs and all my object instantiations? Or is the memory state of the app saved someplace and then is restored back to the state that it was in before something else was brought to the foreground in which case not much needs to be done because all the objects and listeners will still be there?

  • 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-25T21:37:09+00:00Added an answer on May 25, 2026 at 9:37 pm

    I think the problem is that the launch activity in your manifest is the legalbabble activity, so when you click on the icon, the system launches another one. A better architecture would be to launch the legalbabble activity it from your EtMain activity in the onCreate method of the latter, using startActivityForResult. From the docs:

    As a special case, if you call startActivityForResult() with a requestCode >= 0 during the initial onCreate(Bundle savedInstanceState)/onResume() of your activity, then your window will not be displayed until a result is returned back from the started activity.

    When you get the result in onActivityResult, you can call finish() if the legal stuff was declined; otherwise everything will proceed normally.

    This avoids the problem that the launch activity defined in your manifest finishes when the legal stuff is accepted.

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

Sidebar

Related Questions

I am developing a web application about books. We all knows that books have
In books I have seen that it exists but MSDN says it does not???
I have this table that has a lot of book related fields including keywords.
So basically I have two classes, Book and Author . Books can have multiple
Let's say I have books which can be romance, fiction, or mystery. I have
Let's say i have 2 tables Customer and Books. Table Books can have multiple
Imagine that a library contains many books that have many pages. I've got the
I am working on a library app and have books stored as .sqlite files.
There are 3 mysql tables. BOOKS have ID, AUTHOR1, AUTHOR2, PUBLISHER1, PUBLISHER2 AUTHORS have
Assume you have an entity called Library and each Library can contain Books. It

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.