Use of Shared Preferences in Android
For Data Storage Android provides number of ways . Shared Preferences is one of them. We can save primitive data in key-value pairs and reuse it across multiple Activities. The SharedPreferences class provides a general framework that allows to save and retrieve persistent key-value pairs of primitive data types. This data exists even the Application is killed. Steps: 1) To get the Object of SharedPreferences use : SharedPreferences sharedPrefs = this.getSharedPreferences("newPrefs",MODE_WORLD_READABLE); In getSharedPreferences() just put the file name and the mode. 2)To write some data use : SharedPreferences.Editor prefsEditor = sharedPrefs.edit(); 3)Simple put the data : prefsEditor.putString(MY_NAME, "Subrat Mohanty"); prefsEditor.putString(MY_ID, "E3141"); prefsEditor.putBoolean(MY_STATUS, true); 4)Commi...