Button.setOnClickListener doesn't work?
- by user164589
Hi guys,
I am trying to make a button using programmable way.
My code is :
Button mybutton = new Button(this);
mybutton.setText("My Button");
linearLayout.addView(mybutton, 3);
mybutton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Log.println(Log.ERROR, "MyApp", "Clicked on the button.");
}
});
But its setOnClickListener doesn't work.
What is wrong for me ?
Please help.
Thanks.