Skip to content
Otto Event-bus Sample Application
Java
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.settings
compile-libs
libs
res
screenshots
src/com/stephenasherson/ottosample
.factorypath
.gitignore
AndroidManifest.xml
README.md
ic_launcher-web.png
proguard-project.txt
project.properties

README.md

Android-OttoSample

Otto is an event bus designed to help parts of your Android application communicate more effectively and in a more decoupled manner.

One particular area where the Otto event bus can be very useful is in the passing of complex data objects between the Activity and Fragment objects in your application. For instance, when passing a data object between two fragments, traditional methods relied on passing the object via the parent activity or by using the setTargetFragment()/getTargetFragment methods of the Fragment class; a downside to these approaches is that it couples your fragments/activities to one another. Whilst one can use Interfaces to alleviate the coupling, it requires additional boilerplate code and if more than a single object is required one can be faced with handling the code and coupling of many Interfaces, which is often excessive.

Otto reduces this complexity by allowing the production and subscription of strongly typed objects/events on a single event bus. This takes away the coupling between Activities and/or Fragments but still allows a given Activity/Fragment to be strongly tied to the object/event it is interested in.

This project is a simple demonstration of how the Otto event bus can be used to communicate an object between two fragments. Please note that this project also makes use of Android Annotations for object/view depedency injection.

Release Notes

  • v1.0: Initial commit and official 1.0 release

Who Made It?

Stephen Asherson [http://www.stephenasherson.com]

You can’t perform that action at this time.