public class A extends Activity {
public void onCreate(Bundle b){
~
Button b1 = (Button) findViewById(R.id.btn);
b1.setOnClickListener(new B());
~
}
}
public class B extends OnClickListener{
~ do something public void onClick() etc..
}
İs it possible or is there an any way to do this?
OnClickListener
is an interface, so depending on what you want to do with it you can either use:Looking at your example, I assume that you want the second option:
Use it like this:
b1.setOnClickListener(new MyClickClass());