Questions tagged [greenrobot-eventbus-3.0]

EventBus is an open-source library for Android using the publisher/subscriber pattern to solve the problem of loose coupling. EventBus enables central communication to decoupled classes with just a few lines of code – simplifying the code, removing dependencies, and speeding up app development.

EventBus: Events for Android

EventBus is an open-source library for Android using the publisher/subscriber pattern to solve the problem of loose coupling. EventBus enables central communication to decoupled classes with just a few lines of code – simplifying the code, removing dependencies, and speeding up app development. EventBus System

Benefits using EventBus: It…

  1. simplifies the communication between components
    • decouples event senders and receivers
    • performs well with Activities, Fragments, and background threads
    • avoids complex and error-prone dependencies and life cycle issues
  2. is fast; specifically optimized for high performance
  3. is tiny (<50k jar)
  4. is proven in practice by apps with 100,000,000+ installs has advanced features like delivery threads, subscriber priorities, etc.

Further EventBus Features

  • Convenient Annotation based API: Convenient Annotation based API: Simply put the @Subscribe annotation to your subscriber methods. Because of a build time indexing of annotations, EventBus does not need to do annotation reflection during your app’s run time.
  • Android main thread delivery: When interacting with the UI, EventBus can deliver events in the main thread regardless how an event was posted.
  • Background thread delivery: If your subscriber does long running tasks, EventBus can also use background threads to avoid UI blocking.
  • Event & Subscriber inheritance: In EventBus, the object oriented paradigm apply to event and subscriber classes. Let’s say event class A is the superclass of B. Posted events of type B will also be posted to subscribers interested in A. Similarly the inheritance of subscriber classes are considered.
  • Jump start: You can get started immediately – without the need to configure anything – using a default EventBus instance available from anywhere in your code.
  • Configurable: To tweak EventBus to your requirements, you can adjust its behavior using the builder pattern.
59 questions
0
votes
1 answer

Change SnackBar BackgroundColor EventBus Exception

The activity receives the event from a Fragment, the activity needs to create a snackbar and change the background of the snackbar. But in doing so the error in the log happens like this: 08-28 16:15:58.233 13491-13491 E/EventBus: Could not…
Duk
  • 143
  • 12
0
votes
1 answer

EventBus in viewPager fragment issue

I have thee fragments in viewpager, Fragment1, Fragment2, and Fragment3. fragment1 has a button and when onclick it setEnable(true) a button in fragment2 and the button in fragment 2 setEnable(true) a button3 in fragment3 All seem to work fine, but…
0
votes
1 answer

EventBus does not update textview or button and does not show any errors?

I am communicating two fragments of MyActivity when the event is fired from FragmentA (on button click) I want to change in FragmentB button status to enabled true and textview setText("new text") which are in FragmentB, when I run my app output…
matQ
  • 597
  • 2
  • 13
  • 27
0
votes
1 answer

EventBus communication between two fragments shows No subscribers registered for event class..?

First Time I'm trying to implement EventBus to communicate two fragments of MyActivity (to change button.setEnabled) my SDK 21 this is my POJO event public class ButtonEvent { public final boolean status; public ButtonEvent(boolean status){ …
matQ
  • 597
  • 2
  • 13
  • 27
0
votes
0 answers

GreenRobot's EventBus is always returning a NullPointerException

I am not sure, what is up with this Library, but the results have always been inconsistent(at least for me). I have ActivityA, ActivityB, FragmentB1 inside ActivityB. I will have to pass a String ID from ActivityA to ActivityB, FragmentB1. Since I…
user3314337
  • 341
  • 3
  • 13
0
votes
1 answer

Background thread vs Async thread pool

I see from the GreenRobot EventBus documentation that with thread mode BACKGROUND a single background thread is used and with thread mode ASYNC a thread pool is used. Anyone happen to know whether the background thread used by the BACKGROUND thread…
Adil Hussain
  • 30,049
  • 21
  • 112
  • 147
0
votes
2 answers

Android - Greenrobot EventBus in android?

I am using from greenrobot:eventbus in my project: compile 'org.greenrobot:eventbus:3.0.0' Problem : I am using from EventBus for GPS like bellow : public class ConditionGPS { public static void statusCheck(Activity activity) { final…
0
votes
0 answers

Event bus gives NoClassDefFoundError: android/app/assist/AssistContent error when using onProvideAssistContent for pre MArshmallow devices

While launching my application the event bus service gives an error for java.lang.NoClassDefFoundError: android/app/assist/AssistContent at java.lang.Class.getDeclaredMethods(Native Method) at…
0
votes
1 answer

Run Asynchronous Tasks in Order using AA?

I am trying to run some methods when a button is clicked and then move to next activity something like this: Clicked Ok button -> func1() -> func2() -> funky() -> move to next activity i can't seem to understand what should i do to make this pattern…
0
votes
1 answer

Is Greenrobot EventBus sticky events order guaranteed?

I'm starting using EventBus 3.0.0. I'm having 3 sticky events to be sent from Service to Activity: action started action progress action finished i'm listening to the events on main thread: @Subscribe(sticky = true, threadMode =…
4ntoine
  • 19,816
  • 21
  • 96
  • 220
0
votes
1 answer

How to send event from Activity to service with greenrobot event bus?

Simple EventBus.getDefault().post() bring exception not main thread. How to send event from Activity to service with greenrobot event bus? chronometer = (Chronometer)findViewById(R.id.chrono); …
-1
votes
1 answer

GreenRobot eventbus gradle upgrade failed with de.greenrobot:eventbus:3.1.1

When I tried to upgrade the eventbus SDK with dependancy "de.greenrobot:eventbus:3.1.1", it says couldn't resolve "de.greenrobot:eventbus:3.1.1".
Shalu T D
  • 3,921
  • 2
  • 26
  • 37
-1
votes
2 answers

Android data transfer from activity to another activity's tablayout fragment

OneActivity -> TabLayout - > FragmentA, FragmentB, FragmentC TwoActivity -> some clickable widgets From FragmentA I will go to TwoActivity ang again from TwoActivity to another instance of TwoActivity and again from TwoActivity to another instance…
-2
votes
1 answer

How to use EventBus just for first time in Android

In my application i have 2 activity.Activity A and Activity B. For show Activity B users should go to from Activity A. In activity B i have one button and i want when click on this button finish Activity B and call one method into Activity A. For…
Jake warton
  • 2,163
  • 4
  • 11
  • 20
1 2 3
4