0

I have a Recycler view which opens another fragments with replace. The problem is when I start to open a fragment from the list and press back to fast right after each other at some point the application crashes with the following problem:

E/InputEventSender: Exception dispatching finished signal.
E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
E/MessageQueue-JNI: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
                    at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1527)
                    at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1545)
                    at android.support.v4.app.FragmentManagerImpl.popBackStack(FragmentManager.java:590)

Sometimes it also says no host and both cases the issue is that the Activity is not available to show the fragments. the Stacktrace which is shown Doesn't have any detailed message about some other issue. And now the question is what's causing the Activity destroy? How to understand this?

I use popBackStackImmediate method on back button.

X-HuMan
  • 1,488
  • 1
  • 17
  • 37
  • A possible duplicate of [this link](http://stackoverflow.com/questions/7469082/getting-exception-illegalstateexception-can-not-perform-this-action-after-onsa) – android_griezmann Dec 06 '16 at 09:26

1 Answers1

0

User FragmentManager appropriately and add fragments to backStack. Before popping item from backstack, check if backstack is not empty first.

Aliyu Abdullahi
  • 129
  • 1
  • 4
  • Wouldn't be this covering of the main issue? I always have on fragment on the home screen which should be available in backstack. – X-HuMan Dec 06 '16 at 09:32