Describe SharedPreference storage option with example.



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

Post New Answer

More Android OS Interview Questions

How does android track the application on process?

0 Answers  


How to store arraylist in sqlite database in android?

0 Answers  


How will you record a phone call in Android? How to get a handle on Audio Stream for a call in Android?

1 Answers  


What is wake up sensor?

0 Answers  


When you have two or more activities with the same intent filter action name, the android os will display a

0 Answers  






What is android 8.1 called?

0 Answers  


What is xml/ directory?

0 Answers  


In a previous release, XMPP was turned into GTalk. Will a future version have XMPP?

1 Answers  


Please explain what is an intent? Can it be used to provide data to a contentprovider? Why or why not?

0 Answers  


Order of buttons on dialog box?

0 Answers  


Can you change the os on a phone?

0 Answers  


how to fetch a contact person number from contact application using content provider?

0 Answers  


Categories