Does not work.
SharedPreferences pref; SharedPreferences.Editor editor; Context context; int scorerecord = 0; pref = context.getSharedPreferences("recordmeasure",Context.MODE_APPEND); editor = pref.edit(); editor.putInt("recordmeasure",scorerecord); editor.commit(); scorerecord=pref.getInt("recordmeasure",9); If in the function pref.getInt("recordmeasure",9); to make a mistake in the name of the key "recordmeasure", then 9 is output (the default response is if the key does not exist), that is, a variable seems to be created as a "recordmeasure", but for some reason nothing is recorded there, and when called by the key, the answer is always zero.
scorerecordbefore recording? It looks like you write 0 bydto and get 0. - lllycteditor.putInt("recordmeasure",scorerecord);and see what remains there. Check that you are not callededitor.putInt("recordmeasure", something);with the same key. Well, how can you show the code in which you work with ascorerecord, otherwise it is reset to somewhere, and where it is not clear. - lllyct