title: Play sound continuously onTouch()
body: <p>I want to play a gun shot sound continuously by onTouch. I am doing this for automatic gun sounds. So i have problem with there is delay in sound looping. which does not give real automatic gun sound effect. My main point is there should no delay when sound is playing again and again.
  My code is.</p>
  
  <pre><code>public boolean onTouch(View v, MotionEvent event) {
      // TODO Auto-generated method stub
  
      if (event.getAction() == MotionEvent.ACTION_DOWN) {
          mediaPlayer = MediaPlayer.create(RipleFire.this,
                  sounds[position]);
          // if (mediaPlayer != null &amp;&amp; mediaPlayer.isPlaying()) {
          // mediaPlayer.stop();
          // }
          try {
              mediaPlayer.prepare();
          } catch (IllegalStateException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
          }
          imgflag.setImageResource(pistols[position]);
  
          imgflag.setImageResource(pistolsAnimations[position]);
          mediaPlayer.start();
          mediaPlayer.setLooping(true);
  
      } else if (event.getAction() == MotionEvent.ACTION_UP) {
          mediaPlayer.stop();
          mediaPlayer.reset();
          mediaPlayer.release();
          imgflag.setImageResource(pistols[position]);
      }
  
      return true;
  }
  </code></pre>