Using Android preferences for storage
Android provides a few ways to persist information between sessions, with the simplest option being the preferences system. The preferences system allows you to save key value pairs with primitive data types as values.
To use preferences you need to import SharedPeferences and then use getSharedPreferences() within your activity to get the preferences object:
1
2
3
4
import android.content.SharedPreferences;
// Somewhere in your code
SharedPreferences settings = getSharedPreferences("SomeKey", MODE_PRIVATE);