Have SharedPreferences stored in databases?

Is it correct?

Are SharedPreferences stored in databases?

+3
source share
3 answers

I agree with @Octavian's answer (voted), it is stored inside the file.

Are SharedPreferrences stored in databases?

As I wrote the answer, NO, its stores inside the file inside your project directory.

To view this file, go to DDMS Vista , click Explorer . In File Explorer . data -> data -> your project -> shared_prefs

Above, shared_prefs is a folder containing all the general settings that you declared and used.

+1
source

No, this is wrong. SharedPreferencesstored as XML files in the application directory.

+3

.it

Below is the code used to store and retrieve values ​​through common preference values.

SharedPreferences prefs=getSharedPreferences("Key", 0);
          Editor e=  prefs.edit();
           e.putString("Name", "AAA");
           e.commit();

To get the general privilege value, use the code below

SharedPreferences prefs=getSharedPreferences("Key", 0);
          String s= prefs.getString("Name", "");
-2
source

Source: https://habr.com/ru/post/1789943/


All Articles