0
  • What is the purpose of SharedPreferences in Android?
  • Why it is used ?
  • Where it want to be use?
user3291365
  • 445
  • 3
  • 14
user3251646
  • 278
  • 4
  • 15
  • 1
    Have you goggled?? If yes then there is no need to ask this question. – InnocentKiller Feb 11 '14 at 06:39
  • try this link you will get all information regarding sharedpreferences. http://examples.javacodegeeks.com/android/core/content/android-sharedpreferences-example/ – skyshine Feb 11 '14 at 07:01

3 Answers3

0

Shared preferences is used to save any primitive data: booleans, floats, ints, longs, and strings. This data will persist across user sessions (even if your application is killed). for more visit here

reference earlier answered

Community
  • 1
  • 1
Ashfaque
  • 1,254
  • 1
  • 22
  • 38
0

SharedPreferences is used to permanently store preferences in key:value pair

SharedPreferences is accessible by all the Activity(ies) of an app. Other app cannot directly access the content of shared_prefs

App stores its data/preferences in the SharedPreferences.

E.g. Say in a game u can store ur score, game level, user name, no of kill, etc in the preferences; so that it is accessible all throughout the game; yet by that particular game only.

Game "Gold Miner 2" does it. It is only one example.

Svox tts save ANDROID_ID in preferences file;

You need to keep in mind that if u delete the app, all SharedPreferences will be deleted (/data/data//shared_prefs);

Nik theGeeK
  • 181
  • 12
0

You can read the developer android site about SharedPreference to save light data till your application exists into user's device. It will remain saved even after existing your application.

Storage in android with SharedPreference

SharedPreference in android

Hope it will help you..!!!

Rushabh Patel
  • 3,052
  • 4
  • 26
  • 58