Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Crash when trying to return BlocklyFragment from the back stack #658

Open
utikeev opened this issue Sep 16, 2017 · 1 comment
Open

Crash when trying to return BlocklyFragment from the back stack #658

utikeev opened this issue Sep 16, 2017 · 1 comment

Comments

@utikeev
Copy link

utikeev commented Sep 16, 2017

I have AppCompatActivity with NavigationDrawer having three items. I select one simple fragment, then go to the fragment extending AbstractBlocklyFragment, then select another simple fragment and then press back. The app crashes with the following text:

...E/InputEventSender: Exception dispatching finished signal.
...E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
...E/MessageQueue-JNI: java.lang.IllegalStateException: This flyout is already initialized!
at com.google.blockly.android.FlyoutFragment.init(FlyoutFragment.java:175)
at com.google.blockly.android.control.FlyoutController.setTrashUi(FlyoutController.java:207)
at com.google.blockly.android.control.BlocklyController.setTrashUi(BlocklyController.java:300)
at com.google.blockly.android.control.BlocklyController$Builder.build(BlocklyController.java:2063)
at com.google.blockly.android.BlocklyActivityHelper.<init>(BlocklyActivityHelper.java:157)
at com.google.blockly.android.AbstractBlocklyFragment.onCreateActivityHelper(AbstractBlocklyFragment.java:193)
at com.google.blockly.android.AbstractBlocklyFragment.onCreateView(AbstractBlocklyFragment.java:99)
at android.support.v4.app.Fragment.performCreateView(Fragment.java:2337)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1419)
at android.support.v4.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManager.java:1740)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1809)
at android.support.v4.app.BackStackRecord.executePopOps(BackStackRecord.java:857)
at android.support.v4.app.FragmentManagerImpl.executeOps(FragmentManager.java:2577)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2367)
at android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManager.java:2322)
at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:851)
at android.support.v4.app.FragmentManagerImpl.popBackStackImmediate(FragmentManager.java:794)
at android.support.v4.app.FragmentActivity.onBackPressed(FragmentActivity.java:172)
at android.app.Activity.onKeyUp(Activity.java:2506)
at android.view.KeyEvent.dispatch(KeyEvent.java:2633)
at android.app.Activity.dispatchKeyEvent(Activity.java:2757)
at android.support.v7.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:534)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:58)
at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.dispatchKeyEvent(AppCompatDelegateImplBase.java:316)
at android.support.v7.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:58)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchKeyEvent(PhoneWindow.java:2297)
at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:3995)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3957)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3488)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3541)
[...]

That's how I put transactions into manager:

private fun setFragment(fragment: Fragment) {
        supportFragmentManager.beginTransaction()
                .replace(R.id.content_frame, fragment)
                .addToBackStack(null)
                .commit()
    }
@AnmAtAnm
Copy link
Contributor

AnmAtAnm commented Oct 3, 2017

For anyone who encounters this, you can avoid the issue by preferring FragmentTransaction.hide() and .show() over .replace().

See forum discussion here, and related topic on StackOverflow.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants