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 |
How does android track the application on process?
How to store arraylist in sqlite database in android?
How will you record a phone call in Android? How to get a handle on Audio Stream for a call in Android?
What is wake up sensor?
When you have two or more activities with the same intent filter action name, the android os will display a
What is android 8.1 called?
What is xml/ directory?
In a previous release, XMPP was turned into GTalk. Will a future version have XMPP?
Please explain what is an intent? Can it be used to provide data to a contentprovider? Why or why not?
Order of buttons on dialog box?
Can you change the os on a phone?
how to fetch a contact person number from contact application using content provider?