Home > Mobile >  Android SharedPreferences how to store user preferences
Android SharedPreferences how to store user preferences

Time:09-21

Android SharedPreferences how to store user preferences

CodePudding user response:

Storage will be set when a file name, SharedPreferences app2=getSharedPreferences (" app2 ", 0);
Change the file name to the user id try, or directly to the user id_key named can achieve a goal

CodePudding user response:

It is the key - value of storage you corresponding to different users of different key

CodePudding user response:

SP is a key/value pairs stored key - value, you put each set for the user key in different corresponding preference for value, taking when directly according to the key can get different user preferences

CodePudding user response:

Each user has a key, the value is the user preferences into a json data, if the data save large amount of advice to its own cache

CodePudding user response:

Users are stored in different files, sp essence is stored in XML files, load sp files need to set the file name, file name can be generated according to the user id has rules, for example: config1,
  • Related