Skip to content
This repository has been archived by the owner on May 20, 2019. It is now read-only.

EventBus: Could not dispatch event #38

Open
Axrorxoja opened this issue May 10, 2017 · 3 comments
Open

EventBus: Could not dispatch event #38

Axrorxoja opened this issue May 10, 2017 · 3 comments

Comments

@Axrorxoja
Copy link

Axrorxoja commented May 10, 2017

Hi, Thank you for usefull lib, I use it in fragment.
It's fragment function

 public void onResult(Barcode barcode)
            {
                EventBus bus = EventBus.getDefault();
                bus.removeAllStickyEvents();
                bus.removeStickyEvent(materialBarcodeScanner);
                bus.removeStickyEvent(getActivity());
                if (bus.isRegistered(materialBarcodeScanner))
                    bus.unregister(materialBarcodeScanner);
                materialBarcodeScanner = null;
                listener.onQRScanFinished();
            }
and via listener.onQRScanFinished function I call activity function
 `  @Override
        public void onQRScanFinished()
            {
                getSupportFragmentManager().popBackStack();
                Timber.d("onQRScanFinished");
            }`

After that Event bus say
```EventBus: Could not dispatch event: class com.google.android.gms.vision.barcode.Barcode to subscribing class class com.edwardvanraak.materialbarcodescanner.MaterialBarcodeScanner
                                                                   java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
                                                                       at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1842)
                                                                       at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1860)
                                                                       at android.support.v4.app.FragmentManagerImpl.popBackStack(FragmentManager.java:770)
                                                                       at uz.uzgps.android.viewer.screens.login.LoginActivity.removeLastFragment(LoginActivity.java:125)
                                                                       at uz.uzgps.android.viewer.screens.login.LoginActivity.onQRScanFinished(LoginActivity.java:119)
                                                                       at uz.uzgps.android.viewer.screens.login.fragments.QReaderFragment.onResult(QReaderFragment.java:135)`
@ratanakpek
Copy link

I am error with it too

@bpappin
Copy link

bpappin commented Mar 14, 2018

+1

@bpappin
Copy link

bpappin commented Mar 14, 2018

see #34 and #35

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

No branches or pull requests

3 participants