I am trying to use shared preferences for the Android app after a user logs in. In my app, a user is sent to their log information in an API that gives us the username and id if they are logged in.
I save shared priority data with it:
// Set preferences SharedPreferences Preferences = PreferenceManager.getDefaultSharedPreferences (c); SharedPreferences.Editor Editor = preferences.edit (); Editor.putString ("username", user name); Editor.putString ("user id", userID); Editor.commit (); Then I try to use the data with:
Shared references prefs = getPreferences (MODE_PRIVATE); String restored text = prefs.getString ("username", blank); String Restricted 2 = Prefix. Gate string ("user id", blank); Toast. Make Text (This, Restored Text, Toast. LNNHTHRART) Show (); Toast. Make Text (This, Restored Text 2, Toast. LNGHORART) Show ();
get priority
shared Preferences = PreferenceManager.getDefaultSharedPreferences (c); In getting both settings and methods
GetPreferences is private for activity when you use the getPreferences method then this activity makes priority with the file name.
No comments:
Post a Comment