SharedPreferences
are good and lightweight mechanism how to persist data.
But i think for game it's not a win at all. SharedPreferences
are usually used for persisting non-structured data for example if you have some application that requires login and when User is logged in successfully you can save this state to SharedPreferences
and in next Activities
just check it whether User is logged in or not. But in the game you have (i guess for sure) structured data-structures (for instance players and their properties (values) like reached score, loses, wins etc.).
So i suggest you to think about another mechanism for data persisting. Specifically try to think about a possibility to use classic object serializing or and usage of SQLiteDatabase
which provide more complex solution how to persist structured data.
A main advantage is that you can persist (serialize) whole objects and then simply deserialize them (and not persist them as specific "chunks" in SharedPreferences). Regarding to SQLite
, it provides almost same solution as classic serializing but objects are represented as tables in database.