March 2016
Intermediate to advanced
428 pages
9h 2m
English
Being able to store information about our activities on a temporary basis is very useful, but more often than not, we will want our application to remember information across multiple sessions.
Android supports SQLite, but that could be a lot of overhead for simple data, such as the user's name or a high score. Fortunately, Android also provides a lightweight option for these scenarios, with SharedPreferences.
You can either use the project from the previous recipe or start a new project and call it PersistentData (in a real-world application, you'll likely be doing both anyway). In the previous recipe, we saved mCounter in the session state. In this recipe, we'll add a new method to handle onPause() ...
Read now
Unlock full access