The data-persistence techniques in Android provide options for balancing speed, efficiency, and robustness.
Shared Preferences — When storing UI state, user preferences, or application settings, you want a lightweight mechanism to store a known set of values. Shared Preferences let you save groups of name/value pairs of primitive data as named preferences.
Saved application UI state — Activities and Fragments include specialized event handlers to record the current UI state when your application is moved to the background
Files — It’s not pretty, but sometimes writing to and reading from fi les is the only way to go. Android lets you create and load fi les on the device’s internal or external media, providing support for temporary caches and storing fi les in publicly accessible folders.
There are two lightweight techniques for saving simple application data for Android applications: Shared Preferences and a set of event handlers used for saving Activity instance state. Both mechanisms use an NVP mechanism to store simple primitive values. Both techniques support primitive types Boolean, string, float, long, and integer, making them ideal means of quickly storing default values, class instance variables, the current UI state, and user preferences.