Preferences issues. There are 2 activities (classes). In one, the key "number" is 0, and in the other (in which I worked with this key) = 2. (I unload the keys when starting the program). The code is the same and in the same places (OnCreate), only the variable names are different:

notes = getPreferences(MODE_WORLD_WRITEABLE); Editor ed = notes.edit(); textView1.setText(String.valueOf(notes.getInt("number", 0))); 
  • 2
    I re-read a couple of times ... some sort of set of words ... what's the problem? - Gorets
  • In the fact that in one activity it reads data from the "number" key, but not in the other. - romanzi
  • Well, in short, I answered, we take common preverensy and read the value ... - Gorets
  • one
    and indeed where did you see the way you do ... DEAR DRONCHES - LEARN THE GAME - Gorets

1 answer 1

  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); String val = prefs.getString("number", ""));