Android 9 Development Cookbook(Third Edition)
上QQ阅读APP看书,第一时间看更新

Storing persistent activity data

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(In a real-world application, you'll likely use both options for saving data.)