Re-start a game etc. by user?

enonod

Well-Known Member
Licensed User
Longtime User
What please is the correct way to have the user restart a game or program without closing it via the Back button on the device?
I am a little uncertain regarding the Activity Create which I have set using First Time to allow me to turn the screen without losing anything.

In other words, after reading tutorials etc. I am not sure what will be retained after a user presses a start again or start new game button.
I would need to be sure I am not starting a new version within the old and stacking.
 
Last edited:

derez

Expert
Licensed User
Longtime User
There are two cases:
1. The user has rotated the screen, causing the activity to restart.
2. The user has clicked a button which restarts the game.

in the first case, you have to re-create all the views because they are lost, and in a different arangement due to the rotation. If you used activity_pause smartly then you had saved all the game data in a file and you can reload this data during activity_resume, and continue to play.

In the second case, you can leave the views as they are because the are not lost, you have to restart all the game data to the status of a new game.
 
Upvote 0

enonod

Well-Known Member
Licensed User
Longtime User
The first, I have working. It had not occured to me that I only need to recreate the data and feared I had to call Activity Create in some way.
Many thanks derez.
 
Upvote 0
Top