Vote count:
0
I get NullPointerException from MediaPlayer through onPause() method when exiting from activity. The strange thing is I get no error from LogCat - I had to do if(mp == null) Log.i(TAG, "mp is null"); and this logs to LogCat. After exiting sound is playing for coule of seconds and then stops.
This method I call from onPause():
void releaseThis(){
if(mp == null) Log.i("ASD", "nie ma mediaplayera");
if (mp != null) {
if(mp.isPlaying()){
mp.stop();
}
Log.i("ASD", "a tu już jest mediaplayer");
mp.reset();
mp.release();
mp = null;
}
if(wl.isHeld()){
wl.release();
}
}
- wl is WakeLock - has nothing to do with MP I think.
asked 59 secs ago
NullPointerException from MediaPlayer onPause() looses reference
Aucun commentaire:
Enregistrer un commentaire