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
1
vote
1 answer

EventBus: How to keep track?

I am using an event bus (greenrobot) for communication between fragments and activities. Works great. But one thing I was wondering about: How do people keep track of where these are fired? Example: When I see an onEvent() method somewhere, how…
Jens
  • 6,243
  • 1
  • 49
  • 79
1
vote
2 answers

Communication between Activity and GCMListenerService Android

I am working on an android application with push notification feature using GCM. I have created a class called PushNotificationService which extends GCMListenerService. Inside the onMessageReceived(String from, Bundle data) I am able to get the…
Jhilmil Chatterjee
  • 553
  • 1
  • 6
  • 8
1
vote
1 answer

Know if an Object is subcribed to an event in EventBus or Otto library

I am developing some feature in my app where I receive a push notification and if some screens of my app are running make some stuff in them like update some list, put a badge and other things. Use of push notifications is mandatory, I know that…
Aracem
  • 7,227
  • 4
  • 35
  • 72
1
vote
1 answer

Otto Event Bus: different Event Classes

How does Otto handle different event classes? Is it possible to have different event classes? Would only the listeners that listen to the specific event class get notified? E.g. would the sample below work, with only the listener in class A being…
tsorn
  • 3,365
  • 1
  • 29
  • 48
1
vote
0 answers

Android Espresso keeps running two tests concurrently?

So I have a few Espresso tests set up (under same test file) and I also have Otto which is registering and unregistering this fragment to ensure that there is only once instance of the fragment per app instance. I noticed that some tests were…
1
vote
1 answer

Fragment's onCreateView doesn't save member reference

I have a MainActivity with a ViewPager. The ViewPager consists of two Fragments each holding a single RecyclerView. I need to have a reference to the RecyclerView for updating/animating it etc. in the Fragment. A problem occurs on screen rotation,…
Martin Melka
  • 7,177
  • 16
  • 79
  • 138
1
vote
1 answer

Which one is better Otto or Eventbus ?

I am planning to use event based solution to decouple few aspects in an android Application. This application involves connecting to multiple sockets and receiving events from them asynchronously. I am planning to use Netty NIO for handling these…
praveena_kd
  • 525
  • 5
  • 15
1
vote
0 answers

otto Could not dispatch event

I want to use otto in different activity. I write some code: public class MainActivity extends ActionBarActivity { @Bind(R.id.name) TextView name; public static final float DEFAULT_LAT = 40.440866f; public static final float…
tao huang
  • 11
  • 2
1
vote
1 answer

Otto and Retrofit - Register a retrofit service

Most of the examples that I have seen, registers the retrofit service in the Application's oncreate method. Something like this. class ReaderApplication extends Application { private StoryService mStoryService; private Bus mBus =…
1
vote
1 answer

Android - IntentService runs on UI thread when called with bus event

I'm having a IntentService to perform background request to my API. I'm using Otto Bus to communicate with it. public class MyService extends IntentService { private MyAPI mApi; private MyBus mBus; MyService () { …
user1391967
  • 497
  • 1
  • 6
  • 13
1
vote
1 answer

Post event from fragment to its activity's parent activity

Need help with https://github.com/square/otto. In my application I have ActivityBase with : @Override protected void onResume() { super.onResume(); SmartApplication.bus.register(this); } @Override protected void onPause() { …
Dadroid
  • 1,444
  • 15
  • 16
1
vote
1 answer

Is it ok to use Otto outside android?

I am working on a Java EE project that constantly talks to a webservice, I have some experience using Otto on Android and I was wondering if would be ok if I add it to this project too. What you say?
Marcos J.C Kichel
  • 6,887
  • 8
  • 38
  • 78
1
vote
1 answer

Android, register for Otto events outside of Fragments / Activities?

Otto works great when used in Activities or Fragments, but can I subscribe to events in classes that don't have a onPause / onResume / onDestroy method? If so, what's the best practice to unregister?
ticofab
  • 7,551
  • 13
  • 49
  • 90
1
vote
3 answers

Otto events received twice

I try to use Otto. I think it works so far but I receive the events twice. This is what I have (I followed the example on GitHub): The producer: public class NetworkChangeReceiver extends BroadcastReceiver { @Override public void…
Ralph Bergmann
  • 3,015
  • 4
  • 30
  • 61
1
vote
1 answer

How to avoid Interface-Hell and Eventbus-Confusion?

I develop some apps for android and always come to point where I need to communicate within Fragment to Activity Activity to Fragment Fragment to Fragment Service to Fragment etc. At the Android documentation they recommend to use interfaces to…
loose11
  • 607
  • 6
  • 31