When creating an Android application using Loaders, should every activity and fragment have its own LoaderManager
? Or should there only be one LoaderManager
that the application owns? And lastly, are the "unique IDs" that are used to identify specific LoaderManager
s visible outside of the class?
Specifically, I'm having trouble deciding which classes in my application should implement the LoaderCallback<Cursor>
methods (i.e. should each fragment implement these callbacks, or should I have one fragment implement the callbacks and query the results, sending them to other fragments/activities as necessary)?
Thanks in advance to anyone who can help me out! I couldn't find too much information about this online.
Fragment
s are meant to be designed for re-use (i.e. you don't want to design theFragment
for a single specific parentActivity
), does that mean you don't want to have a specificActivity
responsible for managing aLoader
in aFragment
? Is it better practice to manageLoader
s in theFragment
so they can be attached to multipleActivity
s during the application's life cycle? – Alishiaalisia