问题
I tried to save string value after the app closed and re open.
I look at all of the SharedPreferences but i didn't understand if i need to open new activity or what.
So if you have any idea it will be very helpful.
回答1:
what I recommend that you do is to implement shared preferences... going by this way
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
SharedPreferences.Editor editor = preferences.edit();
editor.putstring("PreferenceName","YOUR PREFERENCE VALUE");
editor.commit;
and whenever you want to check the loginMethod value just call the preference value like this...
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
String myValue= preferences.getString("PreferenceName", "");
if you need more assistant I'll be more than happy to help you
来源:https://stackoverflow.com/questions/25082199/use-shared-preferences-in-xamarin