android - Store and Get Application's Shared Preferences In Activities -


I want to save MainActivity in the shared preferences And get it from MenuException I tried to do this:

Main Activity :

  ISharedPreferences _prefs; ISharedPreferencesEditor Editor = _prefs.Edit (); Editor. Patstrings ("user", type); Editor.Apply ();   

MenuActivity :

  ISharedPreferences _prefs = Application.Context.GetSharedPreferences ("user", FileCreationMode.Private);   

I think I'm not caching main activity in the shared preferences at the application level < P> Therefore, any ideas on how to store shared preferences globally?

OK, this has changed it:

  ISharedPreferences _prefs = Application.Context.GetSharedPreferences ("User", FileCreationMode.Private);   

To do this:

  ISharedPreferences _prefs = PreferenceManager.GetDefaultSharedPreferences (application.Context);    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -