Audio is playing twice in Android Media Player -


in application i'm having method responsible playing file placed under raw directory. when ever call function in onresume() method, sound played twice. have googled , tried different solutions. checking mediaplayer.isplaying() , stopping mediaplayer instance still didn't help.

private void englishsound(){         if(mediaplayer1!=null){             if(mediaplayer1.isplaying()){                 mediaplayer1.stop();              }             mediaplayer1.reset();              mediaplayer1.release();         }          mediaplayer1 = mediaplayer.create(this, r.raw.p012);              mediaplayer1.start();      }   public void onresume() {         super.onresume();        englishsound();      } 

and englishsound() called no else in whole activity. have tried debugging never enters if block containing isplaying().

try release onpause()

 public void onpause() {     super.onpause();     if(mediaplayer1 != null)       mediaplayer1.release(); } 

Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -