From 05d04b69af96576fff38c0431e9b262a7dbfa999 Mon Sep 17 00:00:00 2001 From: dtvv Date: Tue, 2 Oct 2018 08:53:45 -0500 Subject: [PATCH] Realease the resource MediaPlayer used in the SettingsActivity, it was not been released propertly --- .../activities/SettingsActivity.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java index a953b05..a17931c 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/SettingsActivity.java @@ -50,6 +50,14 @@ public class SettingsActivity extends AppCompatActivity{ private SecuritySettingsFragment securitySettingsFragment; + /* + * For the window animation + * */ + private MediaPlayer mediaPlayer; + + + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -64,7 +72,7 @@ public class SettingsActivity extends AppCompatActivity{ @Override public void surfaceCreated(SurfaceHolder surfaceHolder) { //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.setLooping(true); 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) public void goBack(){ onBackPressed();