What’s the right way to shut down a MediaController with an attached MediaPlayer?
You can’t do mediaController.setMediaPlayer(null) – that immediately calls updatePausePlay, which dereferences the null.
You can’t call mediaPlayer.release(), since MediaController is going to call MediaPlayer#getCurrentPosition, and that throws an IllegalStateException after release() has been called.
try the below snippet, in this order