• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps testing if activity exists

emistral

Lurker
Jul 13, 2009
3
0
Hi all,

I have currently a menu activity (not the android standard menus but a background image with some buttons) that will start a game.
The main menu is preceded by a splash screen.
The splashscreen activity has the singletask mode and once it is complete (loading some resources), it is destroyed.
if the home key is pressed while playing a game and the app relaunched via the app launcher, the splash screen activity is recreated however this time I will not load the resources since they have been loaded before (I have a test for this).
What I will do is terminate the activity and go to the main menu activity.
But instead of calling startactivity I would like to know if there is a way to test if the main menu activity exists and if so move it to the foreground to be active.
Then in the main menu activity I want to do the same to bring back the game activity - if it exists .
Help would be much appreciated
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones