I need your help here.. I have the following code:
public class GameActivity extends Activity { TextView test1; String punkte, points; @Override public void onCreate(Bundle savedInstanceState) { test1 = (TextView) findViewById(R.id.test1); punkte = points; SharedPreferences load = getSharedPreferences(punkte, 0); points = load.getString("punkte", "0"); test1.setText(points); } public void mehrPunkte() { punkte = "3"; SharedPreferences load = getSharedPreferences(punkte, 0); points = load.getString("punkte", "0"); test1.setText(points); SharedPreferences save = getSharedPreferences(punkte, 0); save.edit().putString("punkte", punkte).commit(); } But it still shows "0" if i restart the app. What did I do wrong?
mehrPunkte...