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?

Categories

HOME
httparty
string
pyqt
zend-framework
carousel
vsm
nuget-package
code-coverage
webix
arangodb
esoteric-languages
digital-signature
cfml
connector
delphi-xe5
apache2.4
symbols
href
easeljs
firebase-analytics
angular-translate
dotspatial
event-flow
deltaspike
mailkit
carriage-return
hibernate-search
browser-extension
protege4
verifiable-c
signal-strength
twilio-click-to-call
insight
openblas
trojan
page-replacement
colorbar
flac
template-toolkit
shinobi
rocks
docpad
atlas
stax
lrs
async.js
file-uri
dup
tracker-enabled-dbcontext
state-restoration
character-replacement
google-books
video-player
rubaxa-sortable
jsvc
omnifaces
typeconverter
aspectj-maven-plugin
osc
code-documentation
cosine-similarity
sql-scripts
codeplex
live555
malformedurlexception
accesscontrolexception
gtm-oauth2
inputmismatchexception
dtmf
kaleidoscope
video-codecs
pstack
qtconcurrent
paginator
htdocs
winmain
google-floodlight
google-ajax-api
mbeans
massive
photolibrary
cfwindow
ifilter
change-management
wcf-proxy
pnrp

Resources

Encrypt Message