I want to count how many times a button (which are created dynamically) is pressed.
Actually, the problem is that I cannot find a way to return anything out of onclicklistener due to the fact that onClick is Void and onclicklistener can only return as view.
public View.OnClickListener evenbutton(final Button inputbutton,
final LinearLayout layout,
final Button[] wholebutton,
final int count){
return new View.OnClickListener(){
public void onClick(View v){
//stuff
}
}
};
So, now I cannot count or return anything else inside onClick.
How can I count or reach anything outside of onclicklistener when the button is pressed?
You can increment a static field declared in your class.