Search code examples
androidandroid-activity

Resume to sub activity after home is pressed


Very similar to ..When Home is pressed.. with one difference. I have a splash screen which I don't want as part of my stack. It loads a database from raw and the size of it could take a few seconds initially. But I don't want this splash screen to be able to be "backed" on. So I initially had the next activity have the launch mode set to singleTask and reparented. I'm guessing this then breaks the ability for the app to be resumed because the "splash" screen is the main app?

Should I be doing things a little different?

I'd prefer that the splash screen is only seen when the app is first launched. They shouldn't be able to back on to it, and as long as the app itself can be resumed, you won't see it.

Should I have my menu screen as the main app and have it detect whether to launch the splash screen for the first time?


Solution

  • I am doing sort of the same thing. I have a StartupActivity that connects to a server (and stuff). When connected, it starts the MainActivity. MainActivity is set to "singleTask", so you can't BACK to the StartupActivity. And if I hit the HOME button, and then start the app from the program menu, it resumes back into my MainActivity...

    But as I understood it, that is something you managed to do?