I am trying to share a common preference between the two actions of my project, but for some reason I cannot transfer data.
I have Activity A that reads general preferences and Activity B that reads and also edits general preferences.
Here is the code that I use to write down general preferences in Activity B:
SharedPreferences sharedPref = getSharedPreferences("myPrefs", Context.
MODE_WORLD_WRITEABLE);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putString("theme", "black");
editor.commit();
and for reading in action A:
SharedPreferences sharedPref = getSharedPreferences("myPrefs", Context.
MODE_WORLD_WRITEABLE);
String theme=sharedPref.getString("theme","blue");
I tried to use different modes, and it worked in Activity B in PRIVATE mode, but it was not shared with activity A. For some reason, I think I have two different common preferences (one name) for two different actions. How to use the same general preference for both activities?