To learn more about the different methods for storing data on Android, refer to the Data and file storage overview.
This unit discusses Room and Preferences Datastore. Note: Android apps have a number of ways to store data, including both internal and external storage. This codelab teaches the fundamentals of SQL-Structured Query Language-which, while not an actual programming language, provides a simple and flexible way to read and modify a SQLite database with just a few lines of code.Īfter you gain a fundamental knowledge of SQL, you'll be prepared to use the Room library to add persistence to your apps later in this unit. SQLite provides a relational database that allows you to represent data in a similar way to how you structure data with Kotlin classes. SQLite is a common way provided by the Android SDK for Android apps to persist data. Persistent data ensures user-generated content isn't lost when the app is closed, or data downloaded from the internet is saved so it doesn't need to be redownloaded later.
The Clock app stores your recurring alarms, the Google Maps app saves a list of your recent searches, and the Contacts app lets you add, edit, and remove your contacts' information.ĭata persistence-storing or persisting data on the device-is a big part of Android development. Many of the apps you use store data directly on the device.