How can stop mediaPlayer which is already running ,and create new mediaPlayer?
<pre><code>I am working in android. I am creating a mediaPlayer which is running audio files. i have 10 buttons. i have assigned different url to each button. So when i  press button1 then song of url with respect to button 1 is playing. and then i click on 2nd button then song of button 2 is also playing with song 1. but i want to stop song of button 1 when i press button 2.

this is the code i am using for this functionality:-

  public void onClick(View v)
 {

        MediaPlayer mediaPlayer=new MediaPlayer();

        if (mediaPlayer.isPlaying()) 
        {
            mediaPlayer.stop();
            mediaPlayer.release();

        } 

        int i = Integer.parseInt((v.getTag()).toString());
        String str=urls[i];
        try {




                mediaPlayer.setDataSource(str);
        mediaPlayer.prepare();
        mediaPlayer.start();

         } catch (Exception e)
               {
                // TODO Auto-generated catch block
                e.printStackTrace();
        }

    }






 please check my code and let me know what is mistake done by me.
</code></pre>
