From fbfa97754f4a01fd3a754d3472c72ac7163d41e8 Mon Sep 17 00:00:00 2001 From: dtvv Date: Tue, 2 Oct 2018 08:16:36 -0500 Subject: [PATCH] Realease the resource MediaPlayer used in the BoardActivity, it was not been released propertly --- .../activities/BoardActivity.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java index 815e70f..ee43bca 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/BoardActivity.java @@ -98,6 +98,14 @@ public class BoardActivity extends CustomActivity { File photoDirectory; + /* + * For the window animation + * */ + private MediaPlayer mediaPlayer; + + + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -170,7 +178,7 @@ public class BoardActivity extends CustomActivity { @Override public void surfaceCreated(SurfaceHolder surfaceHolder) { //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.setLooping(true); mediaPlayer.start(); @@ -271,6 +279,15 @@ public class BoardActivity extends CustomActivity { loadUserImage(); } + @Override + protected void onDestroy() { + super.onDestroy(); + + //Release the media player + mediaPlayer.release(); + mediaPlayer = null; + } + public void loadUserImage(){ //Search for a existing photo File photoFile = new File(photoDirectory + File.separator + "photo.png");