0

I have an Activity implement LoaderCallbacks and start an AsyncTaskLoader from that Activity. When (due to a screen orientation change) the Activity is being destroyed while the AsycTaskLoader is still loading, the Activity seems to 'lose the connection' to the Loader and onLoadFinished isn't called. How can I reattach my Activity to the Loader so the callback methods are called? I know I can get 'a hold' of the loader with

getSupportLoaderManager().getLoader(loaderID)

but I don't know any further.

fweigl
  • 21,278
  • 20
  • 114
  • 205
  • your application crashing when you the change the screen orientation while fetching result in async task? – Ajay S Mar 06 '13 at 16:11
  • No it isn't, the Loader finishes it's work but never 'publishes' it to the Activity. – fweigl Mar 06 '13 at 16:13
  • So your project works fine when you don't change the screen orientation right? – Ajay S Mar 06 '13 at 16:14
  • Yes. I noticed that the AsyncTaskLoaders onReset() is being called before the Loader finishes even without orientation change, but I guess that's standard behaviour? Anyway, it works fine when there's no orientation change. – fweigl Mar 06 '13 at 16:16

0 Answers0