title: Same method repeated multiple times
body: <p>I started to use Android Studio, and I'm doing a basic project.
  In this project there are 9 buttons that I control with the method setOnClickListener.
  I have to repet this method 9 times, is there another way to control them?  </p>
  
  <p><strong>EDIT:</strong>
  This is what I've done so far:</p>
  
  <pre><code> b1.setOnClickListener(new View.OnClickListener() {
  
          public void onClick(View v) {
              if (b1.getText().toString().equals(""))
                  if (turno == 1) {
                      turno = 2;
                      b1.setText("X");
                  } else if (turno == 2) {
                      turno = 1;
                      b1.setText("O");
                  }
              n_turni++;
              vincitore();
              b1.setEnabled(false);
  
          }
      });
  
      b2.setOnClickListener(new View.OnClickListener() {
  
          public void onClick(View v) {
              if (b2.getText().toString().equals(""))
                  if (turno == 1) {
                      turno = 2;
                      b2.setText("X");
                  } else if (turno == 2) {
                      turno = 1;
                      b2.setText("O");
                  }
              n_turni++;
              vincitore();
              b2.setEnabled(false);
          }
  
  
      });
  
      b3.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              if (b3.getText().toString().equals(""))
                  if (turno == 1) {
                      turno = 2;
                      b3.setText("X");
                  } else if (turno == 2) {
                      turno = 1;
                      b3.setText("O");
                  }
              n_turni++;
              vincitore();
              b3.setEnabled(false);
          }
  
  
      });
  </code></pre>