title: Need to save 5 best times for an Android game
body: <p>I need to save <strong>5</strong> <em>best times</em> (an integer) for a game. The game is a reaction time game. </p>
  
  <p>I'm assuming that the <em>easiest</em> way to do this would be to store it in a <em>text file</em> but I really have no idea how to go about doing this.</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      startButton = (Button) findViewById(R.id.btnStart);
      textTimer = (TextView) findViewById(R.id.textTimer);
      myHandler = new Handler();
  
      startButton.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              startTime = SystemClock.uptimeMillis();
              myHandler.postDelayed(updateTimerMethod, 0);
              MainActivity.this.textTimer.setVisibility(0);
          }
      });
  
      pauseButton = (Button) findViewById(R.id.btnPause);
  
      pauseButton.setOnClickListener(new View.OnClickListener() {
          public void onClick(View view) {
              timeSwap += timeInMillies;
              myHandler.removeCallbacks(updateTimerMethod);
              MainActivity.this.textTimer.setVisibility(0);
          }
      });
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.main, menu);
      return true;
  }
  
  private Runnable updateTimerMethod = new Runnable() {
  
      @Override
      public void run() {
          timeInMillies = SystemClock.uptimeMillis() - startTime;
          finalTime = timeSwap + timeInMillies;
  
          int seconds = (int) (finalTime / 1000);
          int minutes = seconds / 60;
          seconds = seconds % 60;
          int milliseconds = (int) (finalTime % 1000);
          textTimer.setText("" + minutes + ":" + String.format("%02d", seconds) + ":" + String.format("%03d", milliseconds));
          myHandler.postDelayed(this, 0);
      }
  };
  </code></pre>
  
  <p>that is the code i have for now. all i want to happen is that when i press the pause button, it will go to the next screen and display the time. and also there will be a button, let's say "<em>records</em>". if it is pressed, it will display the 5 <em>best times</em>.</p>