menu_on_top
menu_on_top

Reputation: 2613

Media Player Problem

   button.setOnClickListener(new View.OnClickListener() {  

    public void onClick(View v){
               if(mp2.isPlaying()==true)
                       {mp2.stop();
                        mp.start();

                       }
               else
               mp.start(); 


           }      

        });         


        button2.setOnClickListener(new View.OnClickListener() {   

            public void onClick(View v){
                if(mp.isPlaying()==true)
                {mp.stop();mp2.start();}
                else
               mp2.start(); 

           }  

        });   

I press the first btn and the 1st song is playing.i press the second,the first stops and the second begins.But then, as i press the first btn, the second song stops but the first song is not playing...please help!!:)

Upvotes: 0

Views: 167

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006539

You did not call prepare() (or prepareAsync()) and seekTo(0) on your original MediaPlayer to rewind it.

Upvotes: 3

Related Questions