Mediaplayer does not work on OntouchEvent - Android
<p>do you have any idea why a Multimedia player doesn't work on an Ontouchevent (in a surfaceview)? I created a game in which when the players clicks on an object, it should produce a sound. My Multimedia player doesn't work:</p>

<p>Here's a part of my code:</p>

<pre><code>public boolean onTouchEvent(MotionEvent event) {

    Context context = getContext();

    if (System.currentTimeMillis() - lastClick &gt; 300) {
        lastClick = System.currentTimeMillis();
        synchronized (getHolder()) {
            float x = event.getX();
            float y = event.getY();

            for (int i = GoodSprites.size() - 1; i &gt;= 0; i--) {
                Sprite sprite = GoodSprites.get(i);
                if (sprite.isCollition(x, y)) {
                 goodSize--;
                 GoodSprites.remove(sprite);
                 playerScore = playerScore + 10;
                 temps.add(new TempSprite(temps, this, x, y, bmpBlue));
                                     // DOESN'T WORK HERE 
                 MediaPlayer mp = MediaPlayer.create(getContext(),
                            R.raw.jump);
                 mp.start();
                if (mp.isPlaying()) {
                    mp.stop();
                } else {
                    mp.start();
                }
                    break;
                }
            }
        }
    }
</code></pre>

<p>Any suggestions? thanks ahead! :)</p>
