title: Touch events in Android
body: <p>I have a button widget. I want to play sound when the button is pressed and when the user releases the button (takes his finger off the button) the audio playback should be stopped. I have used the following code but it doesn't work.</p>
  
  <pre><code>public boolean onTouch(View v, MotionEvent me) {
      int action = me.getAction();
      if(action == MotionEvent.ACTION_DOWN) {
          playSound();
      } else if (action == MotionEvent.ACTION_UP) {
          stopSound();
      }
      return false;
  }
  </code></pre>