Search code examples
androidandroid-mediaplayer

What is the benefit of the stop() function compared to the pause() function in the MediaPlayer class?


Both functions dont set the current Position to 0 and I have to call seekTo(0) after I called stop() in order to get the desired behavior. Moreover I need to call prepare() after I called stop().

So what is the benefit? I could easily use pause() and seekTo(0) to get the same result...


Solution

  • stop() clears the buffered music from memory while pause() doesn't. It's good practice to release as much memory you can. It will keep your app stable.