Describe SharedPreference storage option with example.
Answer Posted / 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 |
Post New Answer View All Answers
What is the function of an intent filter?
What are the android application main components?
What is the APK format in Android?
What do you mean by anr in android?
When is the onstop() method invoked?
Explain me what is a contentprovider and what is it typically used for?
Why android is most popular operating system in the world?
What are different data storage options are available in android?
What is a listener in android?
What is the mobile application development all about?
How to register a broadcast receiver?
State few disadvantages of android in the mobile market.
How one can parse xml in android?
Is ios better than android?
What is tdd (test-driven development)?