Using Intents or an event bus to communicate within the same app

I understand how to use Intents to communicate with the system/other apps. I understand how to use Intents within the same App. I also understand how to use Otto to communicate within the same App.

What are the Pro/Cons of using Otto vs. Intents to communicate between my Activities/Services?

  • Cursor finalized without prior close() Android
  • Couchdb on Android
  • Android: Scroller Animation?
  • How to apply slide animation between two activities in Android?
  • Android: When to use Dialog vs. Activity
  • Unable to open sync connection! in to the Nexus
  • Related posts:

    Android ListView CHOICE_MODE_MULTIPLE, how to set checked index?
    bad array lengths, notification manager causes phone crash on 4.4
    why use Retrofit when we have OkHttp
    JNI Error on Scene Transition Animation - Layer exceeds max
    Getting UnknownLengthHttpInputStream while getting InputStream from HttpURLConnection in android
    Get signal strength of WIFI and Mobile Data
  • How can you put the android emulator into sleep mode?
  • Using ?selectableItemBackground with a white background color
  • Error: Cannot run aapt
  • Retrofit 2 file down/upload
  • Find distance between two points on map using Google Map API V2
  • Square layout on GridLayoutManager for RecyclerView
  • One Solution collect form web for “Using Intents or an event bus to communicate within the same app”

    Pros for using Otto:

    • You get to design your own event types, versus having to use custom actions or something to distinguish one Intent from another

    • Everything is within your own process (contrast with startActivity() and kin, which always involve IPC, even if the activity you are starting is in your own app), for speed and security

    • A bit less coding, as you aren’t having to instantiate IntentFilter or BroadcastReceiver objects

    • It offers the producer pattern (as a quasi-replacement for sticky broadcasts)

    • Being not part of the OS, it has the potential to be updated more frequently

    Cons for using Otto:

    • It cannot start an activity

    • It cannot start a service

    • It cannot bind to a service

    • It cannot send a broadcast

    • It cannot be used in a PendingIntent or for any true IPC

    IOW, the true comparison for Otto is with LocalBroadcastManager, not with the general use of Intents.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.