Questions tagged [otto]

Otto is an event bus designed to decouple different parts of your application while still allowing them to communicate efficiently. It is designed with Android-specific use cases in mind.

Otto is an event bus designed to decouple different parts of your application while still allowing them to communicate efficiently. It is designed with Android-specific use cases in mind.

Forked from Guava, Otto adds unique functionality to an already refined event bus as well as specializing it to the Android platform.

186 questions
3
votes
1 answer

Passing String with Otto between Fragments

I'm trying to pass String value between fragments using Otto. It seems like @Produce and .post works well. But @Subscribe isn't Working... I've registered BusProvider on Both Fragments. But it isn't working. What should i do to make it…
sukso
  • 145
  • 1
  • 8
3
votes
2 answers

Otto communicating from Fragment to Activity

I've been playing with Otto for the last few days and it's just amazing. However, I've run into a problem, I"m trying to communicate from a Fragment to the Activity. To keep things simple, I have one Activity which hold the Fragment, and in the…
Raza
  • 1,192
  • 4
  • 12
  • 23
3
votes
2 answers

Subscriber not getting fired when using Otto

I'm trying out Otto on Android and i'm trying to send back a message from my Fragment to the Activity. Here's the basics of my code: My Bus provider: public final class BusProvider { private static final Bus mInstance = new Bus(); private…
KG -
  • 7,130
  • 12
  • 56
  • 72
3
votes
1 answer

IllegalArgumentException in OTTO when unregistering the fragment

I use Otto bus to communicate events from activity to the fragments. The problem is, the fragments are managed by the ViewPager and the fragment can be recreated without ever executing its onPause() and/or onResume(). The unpleasant side-effect of…
Bostone
  • 36,858
  • 39
  • 167
  • 227
3
votes
1 answer

Passing data from Activity to Fragment using Otto

In my application I'm adding Fragments dynamically to the container in main activity view. I would like to know what is the best way to pass data when using Otto when we add Fragment. Currently this is how I'm doing it, please in example I'm not…
Mayank Mehta
  • 689
  • 1
  • 8
  • 12
2
votes
1 answer

Do GreenRobot's and Guava's EventBus use reflection?

Our Android app currently uses Otto EventBus, which uses reflection. We want to avoid the overhead of reflection, but keep the flexibility. Does Guava's event bus use reflection? What about GreenRobot's? If they don't do they use code generation…
Ginandi
  • 843
  • 8
  • 20
2
votes
2 answers

Can square's otto be used as replacement of intent?

As a new android developer,it seems to me that passing data from one activity to a fragment or a fragment to an activity is too much code to write. Wondering can otto library can be used as a replacement of intent for passing data ? Can it be used…
rat
  • 143
  • 1
  • 7
2
votes
0 answers

Otto: "java.lang.NoSuchMethodException: start [class android.app.Activity]"

On some of the devices I'm getting this error when trying to send an event with the Otto event bus: Exception java.lang.RuntimeException: Could not dispatch event: class xxx.xxx.MyEvent to handler [EventHandler public void…
Alexander Kulyakhtin
  • 47,782
  • 38
  • 107
  • 158
2
votes
1 answer

Is event bus library mechanism as bad as the use of static variables to pass data between activities?

I'm learning Android, and AFAIK, the standard Android mechanism to pass data between Activities is using Intents which in turn are implemented as IPC on lower level (maybe I'm wrong). It seems that recently have emerged a bunch of libraries to make…
Gerard Bosch
  • 648
  • 1
  • 7
  • 18
2
votes
3 answers

EventBus does not register event on new activity

I have implemented an otto bus example. It works fine, but ONLY on the second time I visit the activity. For example, when I load the app and hit the secret message button I am taken to the activity but the toast does not show. Then I hit the back…
hpCode
  • 51
  • 1
  • 5
2
votes
3 answers

Alternative of stopping service in onDestroy() of Activity Android

I am starting android service by startService() in Activity A. I have multiple activities in my application. Here the problem is with onDestroy() of Activities. What I am doing is generating an event in onDestroy() of activity. Application class…
2
votes
2 answers

Android: Otto event bus implementation

I'm developing Android app which should use pagination on RecyclerView. I use Executor within Service to make webrequests to API and then persist fetched data in DB. To notify about changes in DB and then apply new data in my adapter I suggest to…
Autumn_Cat
  • 790
  • 1
  • 14
  • 28
2
votes
2 answers

Square Otto: @Subscribe is not called in fragment (Android)

I have an abstract fragment in Android which I perform the register and unregister method from the otto bus. Also I have a @Subscribe for a method inside this class. public abstract class MyBaseFrag extends Fragment { @Override public void…
Juan Saravia
  • 7,661
  • 6
  • 29
  • 41
2
votes
1 answer

Square Otto event bus - how to test post and subscription with junit and roboelectric

How do i test an event bus in android . I am using Otto. I have tried: @Mock Bus bus; delcared in my test. But now what i want to do is post an event and then check if the action was performed. The event is created like this: new…
j2emanue
  • 60,549
  • 65
  • 286
  • 456
2
votes
1 answer

Retrofit with Otto - Subscribe not called

I have spent many hours on this problem but still not able to find the right way. Hopefully, someone could help. Situation My app requires to download remote data using Retrofit with Otto. Most of the work has been done, except that the Otto's…