Realease the resource MediaPlayer used in the CryptoNetAccountSettingsActivity, it was not been released propertly
This commit is contained in:
parent
cc69c2676e
commit
c1b8c11d74
1 changed files with 22 additions and 1 deletions
|
@ -56,6 +56,14 @@ public class CryptoNetAccountSettingsActivity extends AppCompatActivity{
|
||||||
|
|
||||||
private CryptoNetAccount cryptoNetAccount;
|
private CryptoNetAccount cryptoNetAccount;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For the window animation
|
||||||
|
* */
|
||||||
|
private MediaPlayer mediaPlayer;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -98,7 +106,7 @@ public class CryptoNetAccountSettingsActivity extends AppCompatActivity{
|
||||||
@Override
|
@Override
|
||||||
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
public void surfaceCreated(SurfaceHolder surfaceHolder) {
|
||||||
//Log.d(TAG,"surfaceCreated");
|
//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.setDisplay(mSurfaceView.getHolder());
|
||||||
mediaPlayer.setLooping(true);
|
mediaPlayer.setLooping(true);
|
||||||
mediaPlayer.start();
|
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 {
|
private class SettingsPagerAdapter extends FragmentStatePagerAdapter {
|
||||||
SettingsPagerAdapter(FragmentManager fm) {
|
SettingsPagerAdapter(FragmentManager fm) {
|
||||||
super(fm);
|
super(fm);
|
||||||
|
|
Loading…
Reference in a new issue