1public class MyActivity extends Activity {
2
3 protected void onCreate(Bundle icicle) {
4 super.onCreate(icicle);
5 setContentView(R.layout.my_layout_id);
6
7 final Button button = (Button) findViewById(R.id.my_cool_button);
8 button.setOnClickListener(new View.OnClickListener() {
9 public void onClick(View v) {
10 // your handler code here
11 }
12 });
13 }
14
15}
16