I saw a video on YouTube that creates a quiz app for Android. I try to do this but inside a Fragment. He used getSharedPreferences somewhere and my problem is I can't use it on a fragment.
Here's the part where im getting the error. I hope someone can help me because I really need it to work. Its my school project.
FragmentQuiz.java
private void updateHighscore(int highscoreNew) {
highscore = highscoreNew;
textViewHighscore.setText("Highscore: " + highscore);
SharedPreferences prefs = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putInt(KEY_HIGHSCORE, highscore);
editor.apply();
}