Hi all,
This is my first post and I am not sure it is the correct forum for this thread.
If not, could someone move it to the appropriate forum? Thanks
Here is my question:
I am currently coding a strategy board game. Because of the nature of the game, the first activity is a splash screen where time consuming tasks are performed. The splash screen has a progress bar.
When the tasks are completed, I start the next activity ( the main menu for the game) with an intent and call finish() on the splash screen to destroy it since I do not need it anymore.
The main menu has several options, one of them is "start game".
I should mention that I want only one instance of each activity and not multiple ones.
My question is related to the navigation between activities.
When the game has started, if I press the home key then from the home screen I long press the home button and select the game.
The game reopened where I left it which is fine
However if I relaunch the application from the application launcher, it will relaunch the splash screen and seems to have destroyed the game that was been played.
This is not the behaviour that I want. I was expecting to restart the activity from where it stopped even if I relaunch it via the app launcher.
I must specify that all activities have the default launch modes.
I have tried to change the launch mode of the splash screen activity to singletask but it is even worse. Whether I try to select my app from the long press home or via the app launcher - after the game has started - it goes back to the splash screen.
It seems I can not find the correct way to define those activities.
Basically what I want is:
Splashscreen opened the first time the activity starts then destroyed and start menu activity.
Then whether I relaunch the activity via the app launcher or long press home key, I want to go back where I was.
And all activities need to be only one instance
If someone could help me, that would be much appreciated.
Thanks
This is my first post and I am not sure it is the correct forum for this thread.
If not, could someone move it to the appropriate forum? Thanks
Here is my question:
I am currently coding a strategy board game. Because of the nature of the game, the first activity is a splash screen where time consuming tasks are performed. The splash screen has a progress bar.
When the tasks are completed, I start the next activity ( the main menu for the game) with an intent and call finish() on the splash screen to destroy it since I do not need it anymore.
The main menu has several options, one of them is "start game".
I should mention that I want only one instance of each activity and not multiple ones.
My question is related to the navigation between activities.
When the game has started, if I press the home key then from the home screen I long press the home button and select the game.
The game reopened where I left it which is fine
However if I relaunch the application from the application launcher, it will relaunch the splash screen and seems to have destroyed the game that was been played.
This is not the behaviour that I want. I was expecting to restart the activity from where it stopped even if I relaunch it via the app launcher.
I must specify that all activities have the default launch modes.
I have tried to change the launch mode of the splash screen activity to singletask but it is even worse. Whether I try to select my app from the long press home or via the app launcher - after the game has started - it goes back to the splash screen.
It seems I can not find the correct way to define those activities.
Basically what I want is:
Splashscreen opened the first time the activity starts then destroyed and start menu activity.
Then whether I relaunch the activity via the app launcher or long press home key, I want to go back where I was.
And all activities need to be only one instance
If someone could help me, that would be much appreciated.
Thanks