Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove fragment crash

I add and remove fragments like this :

ADD

getSherlockActivity().getSupportFragmentManager()
                                .beginTransaction()
                                .setCustomAnimations(R.anim.slide_in_bottom, R.anim.slide_out_top, R.anim.slide_in_top, R.anim.slide_out_bottom)
                                .add(R.id.fragment_explore, fragment)
                                .addToBackStack(null)
                                .commit();
ActivityMain.BACKSTACK_EXPLORE.add(fragment);

REMOVE

Fragment depopFragment = BACKSTACK_EXPLORE.get(BACKSTACK_EXPLORE.size() - 1);
                    getSupportFragmentManager().beginTransaction()
                                                .setCustomAnimations(R.anim.slide_in_top, R.anim.slide_out_bottom, R.anim.slide_in_bottom, R.anim.slide_out_top)
                                                .remove(depopFragment)
                                                .commit();
                    BACKSTACK_EXPLORE.remove(depopFragment);

There is a fast slide animation. The fragment comes from bottom and goes back to bottom.

My issue is when you press the back button (depop the fragment) and before the animation is finished you touch the activity that is appearing behind.

It gives me a simple Fatal signal 11 error (more often on samsung galaxy s3)

Any idea ?

like image 527
An-droid Avatar asked Apr 14 '14 15:04

An-droid


Video Answer


1 Answers

I resolved it, it was related to onCreateAnimation() that i used to know when the animation was finished

view.setLayerType(LAYER_TYPE_NONE, null); 

this line was doing the crash. It seems to be related to hardware acceleration and most likely only on android 4.3

see this link : Disable hardware acceleration, backward compatibility

like image 152
An-droid Avatar answered Oct 09 '22 08:10

An-droid