Plusieurs solutions sont possibles pour gérer les événements sur les boutons

/****************** CAS 1 ***************************/

package com.example.bouton01;

import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.view.View.OnClickListener;
 
public class MainActivity extends Activity implements OnClickListener 
{
         
			Button button1,button2,button3;
			
            @Override
            protected void onCreate(Bundle savedInstanceState) 
            {
                        super.onCreate(savedInstanceState);
                        setContentView(R.layout.activity_main);
                        
                        button1 = (Button) findViewById(R.id.button1);
                        button2 = (Button) findViewById(R.id.button2);
                        button3 = (Button) findViewById(R.id.button3);
                        
                        button1.setOnClickListener(this);
                        button2.setOnClickListener(this);
                        button3.setOnClickListener(this);
                       
            } 
            
            @Override
            public void onClick(View v)
            {
                      
                        switch (v.getId()) 
                        {
	                        case R.id.button1:
	                                    Log.d("MR.bool", "Button1 was clicked ");
	                                    break;
	                        case R.id.button2:
	                        			Log.d("MR.bool", "Button2 was clicked ");
	                                    break;
	                        case R.id.button3:
	                    				Log.d("MR.bool", "Button3 was clicked ");
	                    				break;
	                        default:
                                    break;
                        }
            }

         
            
}

/****************** CAS 2 ***************************/

Dans la description XML, on rajoute   android:onClick

 <Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView1"
        android:layout_below="@+id/textView1"
        android:layout_marginLeft="35dp"
        android:layout_marginTop="45dp"
        android:onClick="sendMessage"     
        android:text="Button" />

package com.example.bouton01;

import android.os.Bundle;
import android.app.Activity;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.view.View.OnClickListener;
 
public class MainActivity extends Activity 
{
         
			Button button1,button2,button3;
			
            @Override
            protected void onCreate(Bundle savedInstanceState) 
            {
                        super.onCreate(savedInstanceState);
                        setContentView(R.layout.activity_main);
                        
                        button1 = (Button) findViewById(R.id.button1);
                        button2 = (Button) findViewById(R.id.button2);
                        button3 = (Button) findViewById(R.id.button3);
                        
                     
                       
            } 

            
            public void sendMessage(View view)
			{
                // Do something in response to button click
            	Log.d("MR.bool", "effergrmefgazem ");
            }
            
}


/****************** CAS 3 ***************************/

Pour chaque bouton, on définit un listener

				button = (Button)findViewById(R.id.clear);
				button.setOnClickListener( new OnClickListener() 
				{
							@Override
							public void onClick(View v)
							{
								message.setText("coucou");
								
							}
				}); 
				


