Android - Shared Preferences Tutorial
Android provides many ways of storing data of an application. One of this way is called Shared Preferences. Shared Preferences allow you to save and retrieve data in the form of key,value pair. In order to use shared preferences , you have to call a method getSharedPreferences() that returns a SharedPreference instance pointing to the file that contains the values of preferences. SharedPreferences sharedpreferences = getSharedPreferences ( MyPREFERENCES , Context . MODE_PRIVATE ); The first parameter is the key and the second parameter is the MODE. Apart from private there are other modes available that are listed below: Sr.No Mode and description 1 MODE_APPEND This will append the new preferences with the already existing preferences 2 MODE_ENABLE_WRITE_AHEAD_LOGGING Database open flag. When it is set , it would enable write ahead logging by default 3 MODE_MULTI_PROCESS This method will check for modification of preferences even if the sharedpreference instance ha...