title: How can I get a sound file to play on each click of a button in Android?
body: <p>I'd like to play a sound as I tap a button like hitting a drum, to have the sound playback as quick as I'm hitting the button. Right now I have to wait for the sound to finish before it will play again. Here's how I've got the sound set up.</p>
  
  <pre><code>MediaPlayer snareMP;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.playdrums);
  
  final MediaPlayer snareMP = MediaPlayer.create(this, R.raw.snare);
  
  ImageView snareDrum = (ImageView) findViewById(R.id.snare);
  
  snareDrum.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              snareMP.reset();
              snareMP.prepare();
              snareMP.start();
          }
      });
  </code></pre>
  
  <p>Any help is greatly appreciated.</p>
  
  <p>Thanks!</p>