Created
August 21, 2017 22:00
-
-
Save nazmulidris/87a6cd8b0a034e5555c142d7db040515 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onStart() { | |
super.onStart(); | |
mPlayerAdapter.loadMedia(MEDIA_RES_ID); | |
Log.d(TAG, "onStart: create MediaPlayer"); | |
} | |
@Override | |
protected void onStop() { | |
super.onStop(); | |
if (isChangingConfigurations() && mPlayerAdapter.isPlaying()) { | |
Log.d(TAG, "onStop: don't release MediaPlayer as screen is rotating & playing"); | |
} else { | |
mPlayerAdapter.release(); | |
Log.d(TAG, "onStop: release MediaPlayer"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment