title: Android handle click event late
body: <p>I am writing a rather simple application in Android, most of the code is handling nice animations to make it look good.</p>
  
  <p>My problem is that sometimes a button is clicked, but the related onClick() from the onClick listener is called only after another button is clicked.</p>
  
  <p>it seams that Android is "buffering" the events and handling them in groups, rather then handling them at the time they were generated.</p>
  
  <p>Did anyone of you got this problem before, or can suggest resolution?</p>
  
  <p>I am not sure if it is important,  but I generally use anonymous objects as my listeners, it makes more sense to me.</p>
  
  <pre><code>        score.setVisibility(VISIBLE);
      score.setClickable(true);
      score.setOnClickListener(new View.OnClickListener() {
          public void onClick(View v) {
              soundEffect.soundForId(SoundEffect.DELETE_SOUND);
              player.setToRmove(true);
  
                              //Toggle trash button to replace the score button and
                              // identify for the user that this player is due to be deleted
              score.setVisibility(GONE);
              score.setClickable(false);
              trashButton.setVisibility(VISIBLE);
              trashButton.setClickable(true);
              trashButton.invalidate();
          }
      });
  </code></pre>