title: how to use getSharedPreferences in Fragment?
body: <p>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.</p>
  
  <p>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.</p>
  
  <p>FragmentQuiz.java</p>
  
  <pre><code> 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();
  }
  </code></pre>