I have following code to play small audio files
private void playVoice() {
if (mPlayVoice != null) {
if (mPlayVoice.isPlaying()) {
Use the following code as i was facing the same exception.
try {
if(mPlayVoice!=null && mPlayVoice.isPlaying()) {
Log.d("TAG------->", "player is running");
mPlayVoice.stop();
Log.d("Tag------->", "player is stopped");
mPlayVoice.release();
Log.d("TAG------->", "player is released");
}
} catch(Exception e){
}
Here write whatever you want to do. Actually the condition checking like isPlaying()
or checking for null generates the IllegalStateException.....