在java中,以这种方式创建按钮后:
Button button1= new Button();
我可以通过这种方式识别按钮的引用
public void actionPerformed(ActionEvent bottonName){
Button name_of_the_button= (Button)bottonName.getSource();
//Inside 'name_of_the_button' I have 'button1'
}
我怎么能在android上做同样的事情?我试过这种方式
public void onClick(View bottonName) {
Button name_of_the_button= (Button )bottonName.getSource();
}
但是在 android 上没有 getSource() 方法。