Realease the resource MediaPlayer used in the BoardActivity, it was not been released propertly
This commit is contained in:
parent
94267c6cc3
commit
fbfa97754f
1 changed files with 18 additions and 1 deletions
|
@ -98,6 +98,14 @@ public class BoardActivity extends CustomActivity {
|
||||||
|
|
||||||
File photoDirectory;
|
File photoDirectory;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
@ -170,7 +178,7 @@ public class BoardActivity extends CustomActivity {
|
||||||
@Override
|
@Override
|
||||||
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||||||
//Log.d(TAG,"surfaceCreated");
|
//Log.d(TAG,"surfaceCreated");
|
||||||
MediaPlayer mediaPlayer = MediaPlayer.create(BoardActivity.this, R.raw.appbar_background);
|
mediaPlayer = MediaPlayer.create(BoardActivity.this, R.raw.appbar_background);
|
||||||
mediaPlayer.setDisplay(mSurfaceView.getHolder());
|
mediaPlayer.setDisplay(mSurfaceView.getHolder());
|
||||||
mediaPlayer.setLooping(true);
|
mediaPlayer.setLooping(true);
|
||||||
mediaPlayer.start();
|
mediaPlayer.start();
|
||||||
|
@ -271,6 +279,15 @@ public class BoardActivity extends CustomActivity {
|
||||||
loadUserImage();
|
loadUserImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onDestroy() {
|
||||||
|
super.onDestroy();
|
||||||
|
|
||||||
|
//Release the media player
|
||||||
|
mediaPlayer.release();
|
||||||
|
mediaPlayer = null;
|
||||||
|
}
|
||||||
|
|
||||||
public void loadUserImage(){
|
public void loadUserImage(){
|
||||||
//Search for a existing photo
|
//Search for a existing photo
|
||||||
File photoFile = new File(photoDirectory + File.separator + "photo.png");
|
File photoFile = new File(photoDirectory + File.separator + "photo.png");
|
||||||
|
|
Loading…
Reference in a new issue