title: How to check if button has been clicked
body: <p>I have a bunch of dynamic buttons which I am setting an onClickListeners as they are produced, as well as tagging them with IDs.</p>
  
  <p>Not sure if this a simple one which I have just spent too much time staring at but this is the problem.</p>
  
  <p>If a user clicks a button, it changes colour this is simple and has been achieved by:</p>
  
  <pre><code>button.setOnClickListener(new View.OnClickListener() {
  
  public void onClick(View v) {
  
  
  if (counter == 0) {
  
  button.setBackgroundColor(Color.parseColor("#FF4DCBBF"));
  
  Toast.makeText(getActivity(), "User Has Been Marked As Present",Toast.LENGTH_LONG).show();
  
  //change boolean value
  
  userPresent = true;
  
  counter++;
  
  } else {
  
  button.setBackgroundColor(Color.parseColor("#FFFFFF"));
  
  Toast.makeText(getActivity(), "User Has Been Marked As Absent",Toast.LENGTH_LONG).show();
  
  //change boolean value
  
  userPresent = false;
  
  counter = 0;
  }
  
  }
  });
  </code></pre>
  
  <p>If the user clicks it again, it will change back to the previous colour - but...</p>
  
  <p>If the user clicks one of the other dynamic buttons that hasn't been previously clicked, the counter is thrown out. </p>
  
  <p>I need to know if the button has been clicked and if not, should mark the user as present. </p>
  
  <p>Currently, If on one button I click it and mark the user as present, and then move onto the next button, I will have to click it once (which marks the user as absent due to the counter) then press it again to mark the user as present.</p>
  
  <p>I need the counter to treat each button individually, any ideas how this could be achieved? </p>