0

I was checking the source code for Loader/LoaderManager. I found the code as follows.

1) LoaderManager first calls the method startLoading() on the Loader.

2) startLoading() in turn calls the onStartLoading().

3) onStartLoading calls the method deliverResult().

Where is the actual background thread started in the Loader? What the code flow tells here is that all the functions are invoked in the UI thread and I could not figure out the background thread starting anywhere.

I want to know how the data is delivered back to the UI thread.

Sumit Trehan
  • 3,985
  • 3
  • 27
  • 42
  • it is not started in `Loader`, it is started in `AsyncTaskLoader` however – pskink Jun 30 '15 at 09:17
  • Can you help me knowing the flow? Not able to get how come the deliverResult() method gets called on the UI thread? And finally onLoadFinished() is called on the UI thread as well? – Sumit Trehan Jun 30 '15 at 09:26
  • see http://androidxref.com/5.1.0_r1/xref/frameworks/base/core/java/android/content/AsyncTaskLoader.java#87 – pskink Jun 30 '15 at 09:38

0 Answers0