From cc69c2676efe80602295d201cbbbd242f59317b7 Mon Sep 17 00:00:00 2001 From: dtvv Date: Tue, 2 Oct 2018 09:16:13 -0500 Subject: [PATCH] Realease the resource MediaPlayer used in the AccountsSettingsActivity, it was not been released propertly --- .../activities/AccountSettingsActivity.java | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/activities/AccountSettingsActivity.java b/app/src/main/java/cy/agorise/crystalwallet/activities/AccountSettingsActivity.java index f93a36e..3331777 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/activities/AccountSettingsActivity.java +++ b/app/src/main/java/cy/agorise/crystalwallet/activities/AccountSettingsActivity.java @@ -43,6 +43,14 @@ public class AccountSettingsActivity extends AppCompatActivity{ @BindView(R.id.tvBuildVersion) public TextView tvBuildVersion; + /* + * For the window animation + * */ + private MediaPlayer mediaPlayer; + + + + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -57,7 +65,7 @@ public class AccountSettingsActivity extends AppCompatActivity{ @Override public void surfaceCreated(SurfaceHolder surfaceHolder) { //Log.d(TAG,"surfaceCreated"); - MediaPlayer mediaPlayer = MediaPlayer.create(AccountSettingsActivity.this, R.raw.appbar_background); + mediaPlayer = MediaPlayer.create(AccountSettingsActivity.this, R.raw.appbar_background); mediaPlayer.setDisplay(mSurfaceView.getHolder()); mediaPlayer.setLooping(true); mediaPlayer.start(); @@ -83,6 +91,19 @@ public class AccountSettingsActivity extends AppCompatActivity{ tabLayout.addOnTabSelectedListener(new TabLayout.ViewPagerOnTabSelectedListener(mPager)); } + + @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);