方法一:
Button butt = (Button) findViewById(R.id.button_second);butt.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
//按钮相应程序代码
}
});
方法二:
public void onCreate(Bundle savedInstanceState) {
....
btnBack.setOnClickListener(new btnBackListen());
}
class btnBackListen implements OnClickListener{
public void onClick(View v) {
// TODO Auto-generated method stub
//按钮响应程序代码
}