title: How do I use onClickListener to count the number of times a button is pressed?
body: <p>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.</p>
  
  <pre><code>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
          }
      }
  }; 
  </code></pre>
  
  <p>So, now I cannot count or return anything else inside onClick.</p>
  
  <p>How can I count or reach anything outside of onclicklistener when the button is pressed?</p>