android
Opening fragment with custom animations and then quickly pressing back causing app to freeze
I am facing a strange issue. When I launch a fragment with setCustomAnimation() using the following code : /** * launch a fragment * * #param containerID - frameLayout ID * #param fragment - fragment we want to launch * #param isAddToBackStack - add to back stack??? */ public void launchFragment(int containerID, Fragment fragment, boolean isAddToBackStack) { FragmentManager mFragmentManager = getSupportFragmentManager(); FragmentTransaction mFragmentTransaction = mFragmentManager.beginTransaction(); mFragmentTransaction.setCustomAnimations(R.anim.anim_transition_enter_fade_in , R.anim.anim_transition_exit_fade_out , R.anim.anim_transaction_fade_in_pop , R.anim.anim_transaction_fadeout_pop) .replace(containerID, fragment); if (isAddToBackStack) { mFragmentTransaction.addToBackStack(null); } mFragmentTransaction.commitAllowingStateLoss(); } When I quickly press the back button before the animation completes the app freezes. I have recorded the App screen. Please check the video below : https://drive.google.com/file/d/0BxFmkFbsB3NhNkRLbm8yQ195TUU/view?usp=drivesdk Any help would be appreciated. Thanks
I think your app is experiencing state loss before the animation ends. Replace your: mFragmentTransaction.commitAllowingStateLoss(); with: mFragmentTransaction.commit(); If by changing the code above causes you IllegalStateException: Can not perform this action after onSaveInstanceState error, then you might want to check this Blog about what's happening. Hope this helps.
Related Links
Using ViewPager with sliding Screen always getting 5 pages?
Create rectangle shape drawable with two side curved corner in android
Android - Out of memory Error. When it run on real device
Android add items to list
rectangle collision detection not working
How to add images to resource chooser?
ImageViewTouch doesn't work with older phones (GestureDetector)
Create EditText by drag drop Android issue
Failed to find provider info for <custom provider>
Latency in playing a .wav/.mp3/.ogg audio file in Android App
MapView change colors
Why the method getChildView is not called?
Getting the thumbnail from a video inside the APK
How to create rounded corner layout from its rounded corner image background?
Android Difficulty in upgrading SQlite table without loosing old data
how to combine custom listview with action bar or setcontentview method?