Search code examples
androidandroid-loadermanager

is possible call getLoaderManager().initLoader two times


i have a too complex query but i can write the same complex query into two simples query

i want to do:

getLoaderManager().initLoader(0, null, new EntityLoader());
getLoaderManager().initLoader(0, null, new EntityCounterLoader());

is this posible in the same FragmentList?


Solution

  • Loaders can be initialized only once (i.e., subsequent calls to initLoader using the same id will not cause the loader to reload - for that you use restartLoader). However, as @user117 mentioned, you can have multiple loaders running concurrently and/oror within the same Activity/Fragment - they just need to have unique ids.