Building an android app that displays a list of of
Dog objects in
Activity A. When you a tap a
Dog in the list, that single dog is accessed by
Fragment B, and 3 other classes.
Dog is modified, it gets passed to
Activity C and
Activity D that all modify it, before finally making a network request.
Currently, I pass the same instance of
Dog back and forth through activities, fragments, and classes using callbacks, parcelable extra in intents, and bundles for fragments. This is getting really messy really fast. Is using a Singleton a good idea in this situation?
Dog were a singleton, how can I load multiple
Dogs to begin with?
Think of the list of
Dogs as a list of empty boxes. After a single
Dog is selected, it goes through a conveyer belt of Activities, Fragments, and helper Classes, where the box gets filled with data. At the end of the user flow, this box is filled up with a bunch of information, ready to be shipped off to the backend server.
Dogbefore you have all the information you need to complete it. A better solution would be to build the components your
Dogconsists of first, say
TongueDrippiness,... that you construct in your activities, and once you've got everything you need, you wrap it all up in a