Life after destruction – persistence
Okay, this is not as heavy as it sounds, but it is an important topic when making games. You have probably noticed that the slightest thing can reset our math game, such as an incoming phone call, a battery that ran flat, or even tilting the device to a different orientation.
When these events occur, we might like our game to remember the exact state it was in so that when the player comes back, it is in exactly the same place as they left off. If you were using a word-processing app, you would definitely expect this type of behavior.
We are not going to go to that extent with our game, but as a bare minimum, shouldn't we at least remember the high score? This gives the player something to aim for, and most importantly, a reason to come back to our game.
An example of persistence
Android and Java have many different ways to achieve persistence of data, from reading and writing to files to setting up and using whole databases through our code. However, the...