This is part of the "Android Data and Networking" learning path. View Path

Saving Data on Android

Sep 15 2020 · Video Course (1 hr, 14 mins) · Beginner

Learn about different ways to save data on Android! Use SharedPreferences to store user-facing configuration, use Files to store complex data in the form of JSON or media files, and use the SQLite Open Helper database to store meaningful objects that you can create, read, update and delete.

4.3/5 6 Ratings

Version

  • Kotlin 1.3, Android 10, Android Studio 4

Store Data In Shared Preferences

Introduction

2:07 Free

Welcome to the Saving Data on Android course! Learn about the concepts of data persistence on Android, what each concept brings, and how they are different.

1

Explore the starter project you'll be working on in the course, and set up your developer environment.

2

Learn how to use Context objects from Android to create SharedPreferences that are private to your app.

3

Learn about the SharedPreferences editors, and how to use them to store data, using commit() and apply() functions.

4

Practice using SharedPreferences to add functions which read the data from Prefs and show it to the user.

5

Learn about local, activity-based preferences, which are unique to Activity classes, and cannot be accessed globally.

6

Conclusion

3:03

Review all the concepts you've learned about SharedPreferences and storing simple user-facing configuration options.

7

Use The File System

Learn about the File System in Android, what Files are used for, data streams, and how to write or read Files.

8

Set up some of the basic file operations that will help you access and work with the File System.

9

Save Files

4:02

Learn how to store data in Files, and how to translate data into JSON structures, using Gson.

10

Read Files

1:53

Learn how to read files, and how to list out all the files in the root or parent directory.

11

Practice using Files by adding more operations to your FilesHelper, and by connecting them to the UI.

12

Learn how to switch to the external storage, to be able to expose your files to other applications.

13

Learn about Scoped Storage, the new way of storing and securing files on Android, and how to migrate.

14

Conclusion

2:26

Review all the concepts you've learned so far, and prepare for the last part of the course, and using databases.

15

Use SQLite Database

Learn about the last concept in data persistence in the course - databases. Learn what SQL is and how SQL databases are formed.

16

Prepare the basic files and operations for your SQLiteOpenHelper database, and future episodes.

17

Learn how to save data in the database, by using ContentValues and writable databases. Explore the data using DBBS.

18

Learn how to read data from the database, using cursors. Display the data in the UI.

19

Practice using the SQLiteOpenHelper and its functions, to add more queries to your database.

20

Learn what database migrations are, and how to use them to add columns to the database and change the schema.

21

Finish your database implementation, by adding the final database query, to update trips with locations.

22

Conclusion

2:39

Congrats on finishing the course! Review all the concepts you've learned so far, and learn about new courses and more content to watch, to expand your knowledge.

23

Who is this for?

All beginner and intermediate Android developers who are looking for ways to store their data locally, support offline mode, or to save data without having to use a remote server.

Covered concepts

  • Local Persistence
  • SharedPreferences
  • File System
  • Data Streams
  • Internal Storage
  • External Storage
  • Gson
  • Media Files
  • Scoped Storage
  • SQL
  • Primary Keys
  • SQLite Open Helper
  • Queries
  • ContentValues
  • Cursors
  • Database Migrations

Contributors

Comments