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
How can I update my android device?
How do I update os?
Are android and google the same thing?
What is the difference between serializable and parseable?
What is the order of dialog-box in android?
Please explain what is an intent? Can it be used to provide data to a contentprovider? Why or why not?
how to fetch a contact person number from contact application using content provider?
What is the generic in java?
how to do inter-thread communication in android, using handlers?
What is an explicit intent?
Where is the ui designer in android?
when will you use dynamic broadcast receivers?
How do I download the latest android os?
Is android marshmallow outdated?
What is the name of the database used in android?