content: package com.example.android.courtcounter;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.TextView;
  
  public class MainActivity extends AppCompatActivity {
      private int scoreTeamA = 0, scoreTeamB = 0;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
      }
  
      @Override
      public void onSaveInstanceState(Bundle savedInstanceState) {
          // Save UI state changes to the savedInstanceState.
          // This bundle will be passed to onCreate if the process is
          // killed and restarted.
          savedInstanceState.putInt("scoreTeamA", scoreTeamA);
          savedInstanceState.putInt("scoreTeamB", scoreTeamB);
          super.onSaveInstanceState(savedInstanceState);
      }
      //onRestoreInstanceState
      @Override
      public void onRestoreInstanceState(Bundle savedInstanceState) {
          super.onRestoreInstanceState(savedInstanceState);
          // Restore UI state from the savedInstanceState.
          // This bundle has also been passed to onCreate.
          scoreTeamA = savedInstanceState.getInt("scoreTeamA");
          scoreTeamB = savedInstanceState.getInt("scoreTeamB");
          displayForTeamA(scoreTeamA);
          displayForTeamB(scoreTeamB);
      }
  
      public void addSixforTeamA(View view) {
          scoreTeamA = scoreTeamA + 6;
          displayForTeamA(scoreTeamA);
      }
  
      public void addThreeforTeamA(View view) {
          scoreTeamA = scoreTeamA + 3;
          displayForTeamA(scoreTeamA);
      }
  
      public void addTwoforTeamA(View view) {
          scoreTeamA = scoreTeamA + 2;
          displayForTeamA(scoreTeamA);
      }
  
      public void addOneforTeamA(View view) {
          scoreTeamA++;
          displayForTeamA(scoreTeamA);
      }
  
      public void addSixforTeamB(View view) {
          scoreTeamB = scoreTeamB + 6;
          displayForTeamB(scoreTeamB);
      }
  
      public void addThreeforTeamB(View view) {
          scoreTeamB = scoreTeamB + 3;
          displayForTeamB(scoreTeamB);
      }
  
      public void addTwoforTeamB(View view) {
          scoreTeamB = scoreTeamB + 2;
          displayForTeamB(scoreTeamB);
      }
  
      public void addOneforTeamB(View view) {
          scoreTeamB++;
          displayForTeamB(scoreTeamB);
      }
  
      public void resetScore(View view) {
          scoreTeamA = 0;
          scoreTeamB = 0;
          displayForTeamA(scoreTeamA);
          displayForTeamB(scoreTeamB);
      }
  
      /**
       * Displays the given score for Team A.
       */
      public void displayForTeamA(int score) {
          TextView scoreView = (TextView) findViewById(R.id.team_a_score);
          scoreView.setText(String.valueOf(score));
      }
  
      /**
       * Displays the given score for Team B.
       */
      public void displayForTeamB(int score) {
          TextView scoreView = (TextView) findViewById(R.id.team_b_score);
          scoreView.setText(String.valueOf(score));
      }
  }
  