Introduction
Android provides you with several options for saving persistent application data. The type of option you choose depends on your specific needs, such as whether the data should be private to your application or accessible to other applications(and the user) and how much space your data requires.
Following are the data storage options provided by the Android:
- Shared Preferences
It stores private primitive data in key-value pairs.
- Internal Storage
It stores private data on the device memory.
- External Storage
It stores public data on the shared external storage.
- SQLite Databases
It stores structured data in a private database.
- Content Providers
Android provides a way to expose even your private data to other applications with the help of a content provider. A content provider is an optional component that exposes read/write access to your application data, subject to whatever restrictions you want to impose.
- Network Connection
It stores data on the web with your own network server.
Points to Remember
- Use Shared Preferences for storing primitive data.
- Use internal device storage for storing private data.
- Use external storage for storing large data sets that are not private.
- Use SQLite databases for storing data in a structured way.