If all you need is to store an integer then SharedPreferences would be best for you to use:
//setting preferences
SharedPreferences prefs = this.getSharedPreferences("myPrefsKey", Context.MODE_PRIVATE);
Editor editor = prefs.edit();
editor.putInt("key", score);
editor.commit();
To get a preference:
//getting preferences
SharedPreferences prefs = this.getSharedPreferences("myPrefsKey", Context.MODE_PRIVATE);
int score = prefs.getInt("key", 0); //0 is the default value
Of course replace "key"
with the key for your high score value and "myPrefsKey"
with the key for your preferences (These can be whatever. It's just good to set them to something recognizable and unique).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…