Is View.OnClickListener() a function or interface? When we try to set a onclicklistener() method in android, we use new View.OnClickListener() and it bugs me there cuz as fa
Sample Code,
Internally it works something like this,
public class MyView{
public stinterface MyInterface{
public void myOnClick(View view);
}
}
public class MyButton{
View view;
public void setOnClicker(MyInterface onClicker) {
onClicker.myOnClick(view);
}
}
public class MyExample{
public void method(){
MyButton myButton = new MyButton();
myButton.setOnClicker(new MyInterface() {
@Override
public void myOnClick(View view) {
}
});
}
}