From d2e388e5de9f6e73c24b592d7572ca51fb73535d Mon Sep 17 00:00:00 2001 From: dtvv Date: Tue, 2 Oct 2018 08:28:52 -0500 Subject: [PATCH] Realease the resource MediaPlayer used in the IntroActivity, it was not been released propertly --- .../activities/IntroActivity.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java index 555ca66..17ec920 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/IntroActivity.java @@ -54,6 +54,14 @@ public class IntroActivity extends CustomActivity { @BindView(R.id.btnImportAccount) public Button btnImportAccount; + /* + * For the window animation + * */ + private MediaPlayer mediaPlayer; + + + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -66,7 +74,7 @@ public class IntroActivity extends CustomActivity { @Override public void surfaceCreated(SurfaceHolder surfaceHolder) { //Log.d(TAG,"surfaceCreated"); - MediaPlayer mediaPlayer = MediaPlayer.create(IntroActivity.this, R.raw.appbar_background); + mediaPlayer = MediaPlayer.create(IntroActivity.this, R.raw.appbar_background); mediaPlayer.setDisplay(mSurfaceView.getHolder()); mediaPlayer.setLooping(true); mediaPlayer.start(); @@ -148,6 +156,15 @@ public class IntroActivity extends CustomActivity { startActivity(intent); } + @Override + protected void onDestroy() { + super.onDestroy(); + + //Release the media player + mediaPlayer.release(); + mediaPlayer = null; + } + @OnClick(R.id.btnImportAccount) public void importAccount() { FragmentTransaction ft = getSupportFragmentManager().beginTransaction();