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 dependency injection. I'm new to both of these concepts, although the former appears to be easier to implement. I'm struggling to see how I would do the latter without considerable effort, despite reading around.
There are the OS dependency injectors dagger, guice and a few others, but they seem like they would be fairly heavy going for a relative newbie like myself to pick up. I'm wondering if it is really worth it learning to use one of these for seemingly minor gains in efficiency/code conventionality. Not to mention that they will bloat my project.
Is it really worth it to implement Otto using DI, when I am only going to be using it to replace a few interfaces and listeners here and there? I'll only really be registering the Bus
in a few fragment-containing activities
I won't be unit testing, and I can live with two or three activities (out of ten) being tightly coupled to their fragments. I can't see anything really bad in doing this, much as it is ill advised, especially if it is relatively easy to switch to dependency injection later on.
Lastly, do I need separate Bus
instances for seperate activity-fragment groups, where communication will only occur within said groups? Its not clear to me from reading whether I need to do this for best practice/efficiency or safety?