Realease the resource MediaPlayer used in the SettingsActivity, it was not been released propertly
This commit is contained in:
parent
d2e388e5de
commit
05d04b69af
1 changed files with 20 additions and 1 deletions
|
@ -50,6 +50,14 @@ public class SettingsActivity extends AppCompatActivity{
|
||||||
|
|
||||||
private SecuritySettingsFragment securitySettingsFragment;
|
private SecuritySettingsFragment securitySettingsFragment;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For the window animation
|
||||||
|
* */
|
||||||
|
private MediaPlayer mediaPlayer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -64,7 +72,7 @@ public class SettingsActivity extends AppCompatActivity{
|
||||||
@Override
|
@Override
|
||||||
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||||||
//Log.d(TAG,"surfaceCreated");
|
//Log.d(TAG,"surfaceCreated");
|
||||||
MediaPlayer mediaPlayer = MediaPlayer.create(SettingsActivity.this, R.raw.appbar_background);
|
mediaPlayer = MediaPlayer.create(SettingsActivity.this, R.raw.appbar_background);
|
||||||
mediaPlayer.setDisplay(mSurfaceView.getHolder());
|
mediaPlayer.setDisplay(mSurfaceView.getHolder());
|
||||||
mediaPlayer.setLooping(true);
|
mediaPlayer.setLooping(true);
|
||||||
mediaPlayer.start();
|
mediaPlayer.start();
|
||||||
|
@ -123,6 +131,17 @@ public class SettingsActivity extends AppCompatActivity{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
|
//Release the media player
|
||||||
|
if(mediaPlayer != null){
|
||||||
|
mediaPlayer.release();
|
||||||
|
mediaPlayer = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@OnClick(R.id.ivGoBack)
|
@OnClick(R.id.ivGoBack)
|
||||||
public void goBack(){
|
public void goBack(){
|
||||||
onBackPressed();
|
onBackPressed();
|
||||||
|
|
Loading…
Reference in a new issue