Hi guyz,
Actually i have make media player to playing some songs, but i am facing one problem
that is When any song is playing after this when i stop this current song, it stop successfully, but at that time when i play this song again, its not work(play)...

please tell me reason and solution of this problem...

Member Avatar for highondota

I am guessing you used mediaPlayer.pause() to stop the audio and have not called mediaPlayer.reset() before calling start() again. Please go through the Android mediaPlayer Life cycle and make sure you do not put the mediaPlayer in a wrong state otherwise your app may crash.

To avoid crashes as far as possible use

if(mediaPlayer!=null)
{
    if(mediaPlayer.isPlaying())
         mediaPlayer.pause();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.