[Add] Android docs: Datastore & Room (#7224)

pull/7227/head
Brian Rodriguez 2 months ago committed by GitHub
parent f177d57b2d
commit 4df1ef730c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 7
      src/data/roadmaps/android/content/datastore@GWq3s1iTxQOp1BstHscJ9.md
  2. 7
      src/data/roadmaps/android/content/room-database@Bfg4So5RlI09zFNcburJd.md

@ -1,3 +1,8 @@
# DataStore
`DataStore` is a new and improved data storage solution by Android, meant to supersede `SharedPreferences`. It is important to understand that it comes in two different implementations: `Preferences DataStore` and `Proto DataStore`. `Preferences DataStore` uses key-value pairs similar to `SharedPreferences`, but it's more robust and handles runtime exceptions more efficiently. On the other hand, `Proto DataStore` uses custom data types to provide type safety. It lets you leverage the power of Protocol Buffers, a language-neutral, platform-neutral mechanism for serializing structured data, as the data storage format. Operating on data in `DataStore` is transactional, meaning that if an error occurs during an operation, all changes are rolled back, so the data remains in a consistent state.
`DataStore` is a new and improved data storage solution by Android, meant to supersede `SharedPreferences`. It is important to understand that it comes in two different implementations: `Preferences DataStore` and `Proto DataStore`. `Preferences DataStore` uses key-value pairs similar to `SharedPreferences`, but it's more robust and handles runtime exceptions more efficiently. On the other hand, `Proto DataStore` uses custom data types to provide type safety. It lets you leverage the power of Protocol Buffers, a language-neutral, platform-neutral mechanism for serializing structured data, as the data storage format. Operating on data in `DataStore` is transactional, meaning that if an error occurs during an operation, all changes are rolled back, so the data remains in a consistent state.
Visit the following resources to learn more:
- [@official@Documentation](https://developer.android.com/topic/libraries/architecture/datastore)
- [@video@Introduction to DataStore](https://www.youtube.com/watch?v=9ws-cJzlJkU&list=PLWz5rJ2EKKc8to3Ere-ePuco69yBUmQ9C)

@ -1,3 +1,8 @@
# Room Database
"Room" is a persistence library introduced by Google that provides an abstraction layer over SQLite to help with robust database access while harnessing the full power of SQLite. Room supports the creation of databases and defines queries in compile-time-checked SQL strings. These databases belong to the data classes that you create representing your app's data. Room comprises three main components: **Database**, a container that holds your app's data tables; **Entity**, representing a table within the database; and **DAO (Data Access Object)**, containing SQL query methods to interact with the database.
"Room" is a persistence library introduced by Google that provides an abstraction layer over SQLite to help with robust database access while harnessing the full power of SQLite. Room supports the creation of databases and defines queries in compile-time-checked SQL strings. These databases belong to the data classes that you create representing your app's data. Room comprises three main components: **Database**, a container that holds your app's data tables; **Entity**, representing a table within the database; and **DAO (Data Access Object)**, containing SQL query methods to interact with the database.
Visit the following resources to learn more:
- [@official@Save data in a local database using Room](https://developer.android.com/training/data-storage/room)
- [@video@The full beginner guide for Room in Android](https://www.youtube.com/watch?v=bOd3wO0uFr8&t=10s)

Loading…
Cancel
Save