Can't perform this action after onSaveInstanceState
See original GitHub issuejava.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
at androidx.fragment.app.FragmentManager.checkStateLoss(FragmentManager.java:1689)
at androidx.fragment.app.FragmentManager.enqueueAction(FragmentManager.java:1729)
at androidx.fragment.app.BackStackRecord.commitInternal(BackStackRecord.java:321)
at androidx.fragment.app.BackStackRecord.commit(BackStackRecord.java:286)
at com.emaar.shopndrop.navigation.MultiStackNavigator.showInternal(MultiStackNavigator.kt:320)
at com.emaar.shopndrop.navigation.MultiStackNavigator.show(MultiStackNavigator.kt:119)
at com.emaar.shopndrop.activities.MainActivity$fetchRequestDetail$1.onNext(MainActivity.kt:193)
at com.emaar.shopndrop.activities.MainActivity$fetchRequestDetail$1.onNext(MainActivity.kt:178)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:201)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:255)
at io.reactivex.android.schedulers.HandlerScheduler$ScheduledRunnable.run(HandlerScheduler.java:124)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7356)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
@tunjid I’m getting this error. What I’m trying is after launching MainActivity hitting the web API and launching fragment.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
Handling IllegalStateException: Can not perform this action ...
When the user change the Location Setting, it will then trigger the call of onResume() again, even after onSaveInstanceState() is called. Hence this...
Read more >Can not perform this action after onSaveInstanceState with ...
Basically I just had to : @Override protected void onSaveInstanceState(Bundle outState) { //No call for super(). Bug on API Level > 11. }...
Read more >IllegalStateException : Cannot perform this action after ...
The main root cause of this exception is that fragment transactions are not allowed after the OnSaveInstanceState of the activity is called.
Read more >IllegalStateException: Can not perform this action after ...
Cause of the problem: after call of onSaveInstanceState fragment manager cannot apply any transactions. Possible solution: call cleanUp method ...
Read more >Bug: "IllegalStateException: Can not perform this action after ...
I am getting the same error. The way I am reproducing is to hold my thumb on a menu button and with another...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tunjid I just found this: https://stackoverflow.com/a/10261449
I do have a
onSaveInstanceState
which add something in the outState after callingsuper
. As I understand the accepted answer on the SO thread, the exception is happening because MultiStackNavigator is callingfragmentManager.commit
instead ofcommitAllowingStateLoss
.We’ll try to fix our
onSaveInstanceState
as I don’t think changing fromcommit
tocommitAllowingStateLoss
on your side is a proper solution!@guyaumetremblay sorry buddy I can’t remember what exactly was the problem.