I made simple puzzle game. I want to add a "Resume" option to it, so when user opens the game, he can pick up where he left off last time.
|
There are several ways to preserve state in Android apps. If your gameplay is limited to a single You can also use Probably not the best approach for games, other than some deep inventory RPGS, every Android device has an SQL instance built in. Finally, you have access to the file system. Both in an application private folder accessible by If you want state to persist between reinstalls, you'll have to look at setting up backup support for your app, or run a server that can store and retrieve state. I've had good luck with using Google App Engine for network server (for free!). |
|||
|
|
|
You'll have to write your current game-state to "disk" whenever the user quits the application or triggers a "save-game" manually. This is also called serialization. Whenever the application resumes, deserialize the data and restore the previous game-state. The data that is needed for serialization heavily depends on your game. I'm not an android developer, but I suggest you have a look at the Serializable Interface and the onPause and onResume callbacks. |
|||
|
|