From the course: Android Development Essential Training: Manage Data with Kotlin

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Save files to internal storage

Save files to internal storage

From the course: Android Development Essential Training: Manage Data with Kotlin

Start my 1-month free trial

Save files to internal storage

- [Narrator] My app is getting its data from a remote web service. But it's important to be able to store data persistently on the device itself. You can do this in a number of ways, either by saving the data in structured data files, or for more flexibility and power, in an SQL-like database. I'll start by showing how to save data in simple text files. Files can be saved in a couple of different locations. The Android SDK refers to storage that isn't visible to the user as internal storage, and to files in visible areas as external storage. Internal files can be stored persistently for as long as the app is installed on the device. There's also a strategy where you use a specially named cache directory. Those files are eligible to be cleaned out by the system if you get low on storage space. And again, you can read and write to both of these locations without specific permissions. First, I need some code to transform data into a json formatted string. I'm in my Monster repository…

Contents