Types of storage like Shared Preference, Internal Storage, External Storage, SQLite and Network DB

Опубликовано: 11 Июль 2026
на канале: Sarthak Education (CDPatel Digital Room)
3,725
59

Internal file storage: Store app-private files on the device file system.
By default, files saved to the internal storage are private to your app, and other apps cannot access them (nor can the user, unless they have root access). This makes internal storage a good place for internal app data that the user doesn’t need to directly access. The system provides a private directory on the file system for each app where you can organize any files your app needs.


External file storage: Store files on the shared external file system.
Every Android device supports a shared “external storage” space that you can use to save files. This space is called external because it’s not a guaranteed to be accessible — it is a storage space that users can mount to a computer as an external storage device, and it might even be physically removable (such as an SD card). Files saved to the external storage are world-readable and can be modified by the user when they enable USB mass storage to transfer files on a computer.


Shared preferences: Store private primitive data in key-value pairs.
If you don’t need to store a lot of data and it doesn’t require structure, you should use SharedPreferences. TheSharedPreferences APIs allow you to read and write persistent key-value pairs of primitive data types: booleans, floats, ints, longs, and strings.
The key-value pairs are written to XML files that persist across user sessions, even if your app is killed. You can manually specify a name for the file or use per-activity files to save your data.

Databases: Store structured data in a private database.
Android provides full support for SQLite databases. Any database you create is accessible only by your app. However, instead of using SQLite APIs directly, we recommend that you create and interact with your databases with the Room persistence library.
The Room library provides an object-mapping abstraction layer that allows fluent database access while harnessing the full power of SQLite.