No subscribers registered for event class org.greenrobot.eventbus.SubscriberExceptionEvent

728 Views Asked by At

Why the debug was giving me this? everything is works fine i just did not understand why Eventbus giving me this??

can someone please help me? so much thanks

it just bothering me that i have a problem with my codess

This is the Log.

E/EventBus: Could not dispatch event: class com.creamydark.Izone.JoYuri.YuriActionMessage to subscribing class class com.creamydark.musilization.MainActivity java.lang.IndexOutOfBoundsException: Index: 5, Size: 5 at java.util.ArrayList.get(ArrayList.java:437) at com.ashokvarma.bottomnavigation.BottomNavigationBar.selectTabInternal(BottomNavigationBar.java:530) at com.ashokvarma.bottomnavigation.BottomNavigationBar.selectTab(BottomNavigationBar.java:477) at com.ashokvarma.bottomnavigation.BottomNavigationBar.selectTab(BottomNavigationBar.java:467) at com.creamydark.musilization.MainActivity.onPageSelected(MainActivity.java:455) at androidx.viewpager.widget.ViewPager.dispatchOnPageSelected(ViewPager.java:1941) at androidx.viewpager.widget.ViewPager.scrollToItem(ViewPager.java:686) at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:670) at androidx.viewpager.widget.ViewPager.setCurrentItemInternal(ViewPager.java:631) at androidx.viewpager.widget.ViewPager.setCurrentItem(ViewPager.java:612) at com.creamydark.musilization.MainActivity.eventMessage(MainActivity.java:204) at java.lang.reflect.Method.invoke(Native Method) at org.greenrobot.eventbus.EventBus.invokeSubscriber(EventBus.java:510) at org.greenrobot.eventbus.EventBus.postToSubscription(EventBus.java:433) at org.greenrobot.eventbus.EventBus.postSingleEventForEventType(EventBus.java:414) at org.greenrobot.eventbus.EventBus.postSingleEvent(EventBus.java:387) at org.greenrobot.eventbus.EventBus.post(EventBus.java:268) at org.greenrobot.eventbus.EventBus.postSticky(EventBus.java:309) at com.creamydark.musilization.BottomNavFragments.DetailSelectedAlphaFragment$1.onPostExecute(DetailSelectedAlphaFragment.java:111) at com.creamydark.musilization.BottomNavFragments.DetailSelectedAlphaFragment$1.onPostExecute(DetailSelectedAlphaFragment.java:106) at android.os.AsyncTask.finish(AsyncTask.java:771) at android.os.AsyncTask.access$900(AsyncTask.java:199) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:788) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7660) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) D/EventBus: No subscribers registered for event class org.greenrobot.eventbus.SubscriberExceptionEvent

This is my Subscriber from MainActivity.

@Subscribe(sticky = true )
    public void eventMessage(YuriActionMessage message){
        if (message.getAction() == "LOAD_PLAYER_UI") {
            load_ExoPlayerUI();
        } else if (message.getAction() == "LOAD_PLAYER_UI_PLAYPAUSE") {
            load_PlayPauseBtn();
        } else if (message.getAction() == "SET_CURRENT_VIEWPAGER_ITEM_DETAILFRAG") {
            mact_IzoneVIewPager.setCurrentItem(5);
            //EventBus.getDefault().removeStickyEvent(true);
        } else if (message.getAction() == "SET_CURRENT_VIEWPAGER_ITEM_ALBUMFRAG") {
            mact_IzoneVIewPager.setCurrentItem(1);
            //EventBus.getDefault().removeStickyEvent(true);
        }
    }

This is the postEvent in my Fragment Attatch from MainActivity

public void initTrackModelList(long albumid){
        IzoneGetTracksByAlbum izoneGetTracksByAlbum=new IzoneGetTracksByAlbum(this.getActivity(),albumid){
            @Override
            protected void onPostExecute(String s) {
                super.onPostExecute(s);
                initRecyclerView();
                EventBus.getDefault().postSticky(new YuriActionMessage("SET_CURRENT_VIEWPAGER_ITEM_DETAILFRAG"));
            }
        };
        izoneGetTracksByAlbum.execute(mTrackModel);
    }

this is my Event Message Model.

public class YuriActionMessage {
    private String Action;
    public YuriActionMessage(String action){
        this.Action=action;
    }

    public String getAction() {
        return Action;
    }

    public void setAction(String action) {
        Action = action;
    }
}
1

There are 1 best solutions below

0
On

It's not about Eventbus. Sometimes errors in your code are thrown as Eventbus exceptions. Check your code. For example:

 mact_IzoneVIewPager.setCurrentItem(5);