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 android version 7.0 called?
How to use hashmap with arraylist in android?
What is so special about android?
What is an Intent in Android?
What are the names of the specific logcats?
How many types of layouts are there in android?
What is data binding in android?
how to update ui from other thread?
Can I upgrade my version of android?
How to define a new sencha touch class?
What is one shot?
Can you deploy executable JARs on Android? Which packaging is supported by Android?