greenrobot-eventbus

Subscriber class has no public methods called on Event

南笙酒味 提交于 2019-12-04 04:21:47
while using green Robot Eventbus I got an error E/AndroidRuntime(2537): Caused by: de.greenrobot.event.EventBusException: Subscriber class com.example.MyActivity has no public methods called onEvent Details: I'm loading Activity which contains a fragment with 10 child fragments, rather than calling EventBus.getDefault().register(this); in every nested (child) fragment I called that register in a parent activity of that fragment. Solved by declaring the onEventMainThread method and EventBus.getDefault().register(this); in a same fragment (should be declared in same class) Declaring the

Which Activity lifecycle methods are best to register/unregister to event bus?

£可爱£侵袭症+ 提交于 2019-12-03 14:48:56
问题 What is the best place to register and unregister to an event bus (like otto, EventBus, or tinybus) in an Activity and why? onCreate()-onDestroy() onStart()-onStop() onResume()-onPause() Otto's example uses onResume()-onPause(), EventBus's mentions onStart()-onStop(), and we needed to use onCreate()-onDestroy() in our app to update the activity's UI even when it was in the background. So I guess it can be any of the three depending on the nature of the events and their handling, but I was

Is it good to replace broadcast receiver with Greenrobot Eventbus for triggering event based functions and data transfer from service to activity?

谁都会走 提交于 2019-12-03 05:05:44
问题 I have implemented a service, where I handle the state changes(connect, disconnect, onServiceDiscoverd, onCharacteristicChange etc) and receiving data from another device through gatt Server. My question is, Can the events be handled efficiently using Greenrobot Eventbus replacing broadcast receiver between service and Activity ? 回答1: Unlike LocalBroadcastManager, EventBus is more simple to use. You only go via 3 steps: 1- Create an event class. A simple Java class that represent the response

Which Activity lifecycle methods are best to register/unregister to event bus?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-03 04:35:39
What is the best place to register and unregister to an event bus (like otto, EventBus, or tinybus) in an Activity and why? onCreate()-onDestroy() onStart()-onStop() onResume()-onPause() Otto's example uses onResume()-onPause(), EventBus's mentions onStart()-onStop(), and we needed to use onCreate()-onDestroy() in our app to update the activity's UI even when it was in the background. So I guess it can be any of the three depending on the nature of the events and their handling, but I was wondering if there is anything more to it that should be considered. @levavare, I think the correct time

EventBus - Subscriber class and its super classes have no public methods with the @subscribe annotation

最后都变了- 提交于 2019-12-03 04:30:40
I'm creating an Android application using EventBus for posting asynchronous broadcasts to other classes, but I'm running into an error during execution. MainActivity.java import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.EditText; import com.google.android.gms.maps.model.LatLng; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; public class MainActivity extends AppCompatActivity { /

IPC in Android using GreenRobot eventbus

五迷三道 提交于 2019-11-30 19:27:31
I need to communicate with a remote service, using (greenrobot) EventBus. Unfortunately, it does not seem to work with IPC. Looking at the code, I don't see a workaround either. Any help would be appreciated ! Bonus question - are there any other EventBuses (for Android) which support IPC ? I need to communicate with a remote service, using (greenrobot) EventBus. The entire point of greenrobot's EventBus, like Square's Otto and LocalBroadcastManager , is to not use IPC. Any help would be appreciated ! Don't use greenrobot's EventBus for IPC. Use one of Android's myriad IPC mechanisms for IPC: