Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IllegalStateException: Can not perform this action after onSaveInstanceState #27

Closed
bjorncs opened this issue Nov 4, 2013 · 6 comments
Assignees
Labels

Comments

@bjorncs
Copy link
Contributor

bjorncs commented Nov 4, 2013

The looks like the Dialog class does not play well with its parent activity's life-cycle. I got following crash when the UpdateChecker tried to open a dialog in an activity that was already closed:

java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1343)
at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1361)
at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:595)
at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:574)
at android.support.v4.app.DialogFragment.show(DialogFragment.java:127)
at com.rampo.updatechecker.UpdateChecker.showDialog(UpdateChecker.java:299)  
@pietrorampini
Copy link
Owner

Fixed. 21c032a
Going to merge soon.

@bjorncs
Copy link
Contributor Author

bjorncs commented Nov 16, 2013

Your patch is not working correctly. You are catching on NullPointerException, while the exception you want to catch is a IllegalStateException.

@pietrorampini
Copy link
Owner

Did you tried?
Personally I've tested it and works great, because the NullPointerException catch the cases when getActivity() returns null, as when the app it's already closed. I didn't spotted the bug again whit this fix.

@bjorncs
Copy link
Contributor Author

bjorncs commented Nov 17, 2013

Yes, I still get bug reports on this one. Look at the stack trace on first post. It is a IllegalStateException.

@pietrorampini pietrorampini reopened this Nov 19, 2013
pietrorampini added a commit that referenced this issue Nov 19, 2013
@pietrorampini
Copy link
Owner

Does it works? @bjorncs

@bjorncs
Copy link
Contributor Author

bjorncs commented Dec 1, 2013

I haven't been able to get it tested out live yet. Anyway, I propose we just close this issue, as this fix should obviously work.

@bjorncs bjorncs closed this as completed Dec 1, 2013
@ghost ghost assigned pietrorampini Dec 11, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants