From c1b8c11d74554e7037dd7c8d07bbb1bf2c9323bf Mon Sep 17 00:00:00 2001 From: dtvv Date: Tue, 2 Oct 2018 09:17:19 -0500 Subject: [PATCH] Realease the resource MediaPlayer used in the CryptoNetAccountSettingsActivity, it was not been released propertly --- .../CryptoNetAccountSettingsActivity.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/CryptoNetAccountSettingsActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/CryptoNetAccountSettingsActivity.java index 460cfdc..429f6f4 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/CryptoNetAccountSettingsActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/CryptoNetAccountSettingsActivity.java @@ -56,6 +56,14 @@ public class CryptoNetAccountSettingsActivity extends AppCompatActivity{ private CryptoNetAccount cryptoNetAccount; + /* + * For the window animation + * */ + private MediaPlayer mediaPlayer; + + + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -98,7 +106,7 @@ public class CryptoNetAccountSettingsActivity extends AppCompatActivity{ @Override public void surfaceCreated(SurfaceHolder surfaceHolder) { //Log.d(TAG,"surfaceCreated"); - MediaPlayer mediaPlayer = MediaPlayer.create(CryptoNetAccountSettingsActivity.this, R.raw.appbar_background); + mediaPlayer = MediaPlayer.create(CryptoNetAccountSettingsActivity.this, R.raw.appbar_background); mediaPlayer.setDisplay(mSurfaceView.getHolder()); mediaPlayer.setLooping(true); mediaPlayer.start(); @@ -121,6 +129,19 @@ public class CryptoNetAccountSettingsActivity extends AppCompatActivity{ } } + + @Override + protected void onDestroy() { + super.onDestroy(); + + //Release the media player + if(mediaPlayer!=null){ + mediaPlayer.release(); + mediaPlayer = null; + } + } + + private class SettingsPagerAdapter extends FragmentStatePagerAdapter { SettingsPagerAdapter(FragmentManager fm) { super(fm);