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.

Filter by
Sorted by
Tagged with
-1 votes
3 answers
10k views

How to make a synchronous call using Retrofit on Android

I have a login view in an android app that I would like to function synchronously. That is, I want the user to stay on the page until the login rest call completes. If it fails, the user can reenter ...
0 votes
1 answer
715 views

How to use Fetch in JavaScript (V8go, Otto) in Golang?

I am trying to run JavaScript inside of a Golang function, and use fetch to fetch JSON via APIs in the Javascript context. I tried it in Otto with the following code: import "github.com/...
58 votes
7 answers
29k views

How to send event from Service to Activity with Otto event bus?

Simple BusProvider.getInstance().post() bring exception not main thread. How to send event from Service to Activity with Otto event bus?
0 votes
1 answer
310 views

Class not found exception with some builds

I translated fragment to Kotlin. Inside it I have method tagged with Otto's @Subscriebe tag to listen for network communication. When I run some builds this fragment is created and visible, but when ...
0 votes
1 answer
360 views

Event Bus not received

I'm trying to pass an event with Otto Event Bus from the SplashActivity to LoginActivity which is 2 o 3 activities later with: SplashActivity @Override public void onStart() { super....
6 votes
2 answers
6k views

java.lang. RuntimeException No Retrofit annotation found. (parameter #3)

I'm trying to update this RetroFit + Otto tutorial, so my code updated is: IWeather.java RetroFit 2.+ doesn't allow to return void, so instead of void getWeather(...) I added Call<Weather> ...
3 votes
3 answers
445 views

Passing data from Activity to Activity using Otto is not working

It's the first time that I'm using this library, but I was following this video tutorial to send data through Fragments, but in my case, it's just Activities.. So this how I did Activity that I'm ...
47 votes
4 answers
16k views

Is using event library like Otto or EventBus a recommended way to handle relations between Activities, Fragments, and background threads [closed]

In most of the case, when dealing with case User thread (AsyncTask) to perform background processing Pass back calculated result back to Activity or Fragment Activity or Fragment re-creation might ...
20 votes
4 answers
17k views

ClassNotFoundException: Didn't find class "android.os.PersistableBundle" Otto Android 5.0

I have a strange issue. I have an app which I deployed on an Android 4.4 device and use Otto library. I deployed the app on an Android 5.0 device. It still works. I retried on the 4.4 and the app won'...
2 votes
2 answers
837 views

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 ...
0 votes
0 answers
59 views

Two instances of same class cannot produce any methods. (Event Bus otto)

I have encountered a situation where I have a class (let's call this class "A") with a @Produce method. In another class, if I initialize two objects from class "A". Event bus throws an exception ...
5 votes
2 answers
1k views

Can I register an Otto bus on both base and child class?

I'm using Otto event bus in my Android app. I've read the GitHub documentation and various questions posted online about how hierarchy traverse is working: "Registering will only find methods on the ...
0 votes
0 answers
69 views

Otto subscribe and post in the same fragment does not work

I have three fragments in the same activity, let says FragmentA, FragmentB and FragmentC Let´s say that FragmentA sends an int to FragmentB so in the FragmentA I have: //FRAGMENT_A @...
1 vote
1 answer
88 views

Why my new fragment can't subscribe otto

I have made a post in my activity, and it works well in the first fragment BlankFragment, however, when I tried to replace BlankFragment with BlackFragment2, and do the same subscribe, it can't ...
0 votes
1 answer
322 views

how to manager the singleton object's live cycle (where to unregister the otto listener)?

Having a singleton dataManager object which registers the OTTO listener in its constructor to listen to data ready event. In the application the dataManager is referred anywhere as DataManager....
24 votes
4 answers
12k views

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

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 ...
2 votes
3 answers
3k views

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 ...
0 votes
1 answer
421 views

Using otto for inter fragment communication - dependency injection confusing

I wish to use Otto for inter-fragment communication. I want to do this using best practices if I can help it. The Otto example on Github uses a singleton for the Bus object, but recommends using ...
6 votes
2 answers
1k views

RxAndroid, event bus and Activity lifecycle

I found a few articles talking about how RxJava/RxAndroid can replace event busses (such as otto) https://lorentzos.com/rxjava-as-event-bus-the-right-way-10a36bdd49ba#.7a4619qva https://medium.com/...
0 votes
0 answers
56 views

how to stop the otto event propagation

Trying to use otto to replace our native event manager. One use case it has is the event could be subscribed by multiple listeners in different places, but only the first one received it should handle ...
0 votes
1 answer
462 views

How to know when service is started after calling startService() method to send otto event?

I have AlarmReceiver(BrodcastReceiver) that starts DownloadService(Service) after check if service is not running state context.startDownloadServiceIfNotRunning()// kotlin extension function check ...
0 votes
2 answers
1k views

Android. Otto Bus doesn't fire event from onActivityResult() method of Fragment to Activity

I have BaseActivity with register() and unregister() methods: public class BaseActivity extends AppCompatActivity{ ... @Override protected void onResume() { super.onResume(); ...
3 votes
2 answers
484 views

Can bus events be seen by other process?

Imagine I'm using otto to send events over a bus. Is it possible to set up another service that runs on a separate process that can listen to the same bus events? I think since it's another JVM that ...
4 votes
1 answer
5k views

Leakcanary report of memory leak using Otto

Following up on my last question, here is the second memory leak I can not get rid of.. I read that I need to register and unregister my static Otto bus according to the Activity and Fragment ...
14 votes
4 answers
4k views

Otto/EventBus across multiple processes

Is it possible to post event in one process (for example inside SyncAdapter which has android:process=":sync" manifest attribute) and receive it in another (inside regular app UI) with Otto or ...
0 votes
2 answers
2k views

Otto EventBus: Event fired multiple times

I am using the Otto event bus in my android application and have the problems that identical events get fired multiple times (event.hashCode() returns the same integer). The code I use to fire the ...
45 votes
3 answers
9k views

Otto vs LocalBroadcast:

I am a huge fan of open source contributions square has done to the Android community and was looking into their latest contribution Otto (event bus ) http://square.github.io/otto/ Digging deeper I ...
4 votes
5 answers
3k views

Otto throw "Object already registered" onResume in viewpager

I have 2 fragments in viewpager. When application is paused (press home button, or below other application) and then resumed, otto throw E/stack: task on pause E/stack: note on pause E/stack: ...
0 votes
2 answers
143 views

Android - updating Grid UI in debug mode but not updating at run time using Otto

I want to update the icon status from red to green after successfull upload of the image in background service. I am using Otto event bus to transfer data between Service to Activity, I can able to ...
0 votes
1 answer
39 views

Otto not sending data When Activity ReCreates (After OnDestroy)?

I am using Otto to send events from IntentService to my Activity. IntentService is Downloading files from server and send progress to Activity this is working with otto very well. - I have done so ...
6 votes
4 answers
2k views

Otto event no firing

I have an activity and it launches a DialogFragment, on completion of an event the DialogFragment posts an event on the Otto Event Bus, this is to fire a method in it's parent activity. I've posted ...
1 vote
1 answer
1k views

Otto event bus not fired from an activity to another activity with fragments

I am not new to using event bus but I got strange behavior in the following scenario: I have MainActivity which have two fragments that need to update their contents using Otto event bus from ...
0 votes
1 answer
375 views

BusProvider Not Returning to @Subscribe

I am using BusProvider with on Android to handle post backs to the main thread after executing an AsynTask. When the Async task is finished and it is successful it registers the Post and returns to ...
0 votes
1 answer
865 views

Using Otto.Bus Post and @subscribe is not being called

I am trying to get @Subscribe to call back to the activity from an AsyncTask. I have read through the Otto technical documentation and have also read many of different articles online as well as here ...
0 votes
2 answers
425 views

viewpager fragments not receiving otto events from activity

I have an activity with a Viewpager. my viewpager has several fragments. i want to send Otto event to a fragment when it is selected, thus i implement ViewPager.OnPageChangeListener @Override ...
7 votes
1 answer
2k views

Advantages of injecting Otto event bus instead of using static singleton

In my Android apps i'm using Otto as event bus and Dagger for dependency injection. In the userguide of Otto and in many blog posts it's recommended to use injection to get a bus singleton. I have ...
2 votes
1 answer
625 views

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 ...
0 votes
1 answer
1k views

How to run a method when query is finishing?

I am using Firebase. My problem is, while i'm querying objects and then modifying them, my main ui thread goes ahead and runs the next methods. I want my main ui thread to wait until my firebase query ...
3 votes
1 answer
209 views

EventBus Producer has been invalidated and can no longer produce events

I am using RxBus which is an RxJava clone of Otto/EventBus to communicate between the different components of my android app. The app works fine on my Motorola Moto x 2013 running ICS, without crashes....
1 vote
1 answer
1k views

what to use or how best to convert otto event bus (now that otto is deprecated)?

on Square's github i found the following statement: Deprecated! This project is deprecated in favor of RxJava and RxAndroid. These projects permit the same event-driven programming ...
2 votes
2 answers
520 views

Data getting mixed when using Otto in a ViewPager

I am using Otto to get result to a fragment when an http request is made successfully. In my application I have a viewpager. And because the pages are very similar, I use the same fragments in ...
0 votes
1 answer
170 views

Otto events handling order

Please help me to figure out if the following scenarios are valid if I'm going to use Otto Bus lib. If I need to ensure the order of subscriber execution. I have two component that are listening for ...
0 votes
1 answer
201 views

Otto unregistering the same instance

I have a BaseFragment which within it's onCreateView method, creates a MyObject class. Both of these are inside a ViewPager. Two different fragments extends from the BaseFragment - FragmentA, ...
1 vote
1 answer
60 views

Using Ottos bus for 'notification polling'

On all my views I have an icon that will have a red dot if the user has notifications, so I created a class to constantly (every few minutes) poll and see if they have notifications. Except the @...
0 votes
1 answer
102 views

ProgressDialog.show stuck while handling Otto event

There are two activities in my app, CreateOrderActivity and PaymentResultActivity. A 3rd-party payment app is used to finish the payment. CreateOrderActivity -> 3rd-party payment app -> ...
4 votes
3 answers
8k views

Otto(Event bus), send event fragment to fragment but not receiving

MainActivity has a NavigationDrawer and each navigation menu brings Fragment instead of new Activity. There is settings fragment and if I change order of the navigation menu it should be reflected ...
-1 votes
1 answer
326 views

Retrofit + Otto + AA, How to do simple get request?

I am using Android Annotation for boilerplate, and Retrofit for Api calls, While doing post requests through retrofit I discovered a Some problems: When i am calling asynchronous call to "GET" ...
0 votes
1 answer
72 views

How to install Otto on Mac OS X to work in the command line?

How to install Otto on Mac OS X to work in the command line (i.e. by simply typing otto)?
0 votes
0 answers
67 views

Otto Event Bus object post limit

Is there a limit of objects that can be posted to a single event bus? I want to post many user's texts onto an event bus, but I'm worried I'll somehow overload the Bus.
0 votes
2 answers
167 views

RecyclerView reloads when an item is clicked

I am using Firebase for my apps back end and I am retrieving my data as excepted. After I retrieve my data, I am posting it by using otto bus and the code can be seen below. @Subscribe public void ...