title: MediaPlayer stops working with error "Event 11 was not found in the queue, already cancelled?"
body: <p>My app so far is very simple. Just a button that plays a sound. The problem is that if I press the button too fast, I get an error and the media player no longer responds.</p>
  
  <p>Here's my code.</p>
  
  <pre><code>public class Keyboard extends Activity
  {
      private MediaPlayer player = null;
  
      private OnTouchListener listener = new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent e) {
              switch (e.getActionMasked()) {
              case MotionEvent.ACTION_DOWN:
                  System.out.println("down");
                  player.start();
                  break;
              case MotionEvent.ACTION_UP:
                  System.out.println("up");
                  player.pause();
                  break;
              }
              return false;
          }
      };
  
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          player = MediaPlayer.create(getApplicationContext(),
                  R.raw.bloop);
          player.setLooping(true);
  
          Button foo = (Button)findViewById(R.id.A);
          foo.setOnTouchListener(listener);
      }
  }
  </code></pre>
  
  <p>All I'm doing is calling play() when the button is pressed, and calling pause() when the button is let go. Here's a sample of a typical log.</p>
  
  <pre><code>I/System.out( 1796): up
  I/System.out( 1796): down
  I/System.out( 1796): up
  I/System.out( 1796): down
  I/System.out( 1796): up
  W/TimedEventQueue(   38): Event 2 was not found in the queue, already cancelled?
  I/System.out( 1796): down
  I/System.out( 1796): up
  I/System.out( 1796): down
  I/System.out( 1796): up
  </code></pre>
  
  <p>As you can see, my debug statements still work after the error, so the OnTouchListener is still working.</p>