Stopping a media player
<p>I am implementing a media player on android phone.<br>
This player starts based on some conditions, but I am unable to stop it (back button pressing doesn't work). Once the streamer who is sending the data stops, player stops too and crashes. </p>

<p>I want to stop the media player whenever I want by pressing the BACK button. can somebody tell me how to do so?</p>

<p>I have tried using methods like these, but they don't work!!</p>

<pre><code>@Override
public void onBackPressed()
    {
        MediaPlayer.stop();
        MediaPlayer.release();
        finish();
    }


@Override
    protected void onStop()
    {
            finish();
    }
</code></pre>
