Describe SharedPreference storage option with example.
Answer / shubhraneel
If we talk about Android, then there are many ways in which it stores data of application. One way is by 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.
example: SharedPreferences sharedpreferences = getSharedPreferences(MyPREFERENCES, Context.MODE_PRIVATE);
In the above example The first parameter is the key and the second parameter is the MODE
| Is This Answer Correct ? | 1 Yes | 0 No |
What is the use of content provider?
What is onpause?
How much does it cost?
What is handler class do in android?
What are handlers?
What are the android application main components?
How many types of android phones are there?
Write code snippet to retrieve IMEI number of Android phone.
List important file and folder when you create new android application?
How do I restart my android phone in safe mode?
What is android:oneshot?
Tell me two ways to clear the back stack of activities when a new activity is called using intent?