I\'ve got the following button in my xml layout file...
You just need something like this:
Button buttonOne = (Button) findViewById(R.id.button1); buttonOne.setOnClickListener(new Button.OnClickListener() { public void onClick(View v) { //Do stuff here } });