Creating a OnClick Handler for a button:
private void setupListenerButton() {
// TODO Auto-generated method stub
Button btn=(Button) findViewById(R.id.button1);
btn.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v){
//call something}
});
}