0

I have implemented an AsyncTaskLoader passing a complex object not parcelable instantiated in the Activity. This object is loaded too by another loader.

My question: This object can leak the Activity when I rotate the device and the loader is not being restarted, just initiated? (onCreateLoader not called, just returned the object in onLoadFinished). And, if this is the case, how can I set this object in the AsyncTaskLoader?

Thanks in advance.

Ainun
  • 21
  • 1
  • 2
  • you must have used the context of the activity with AsyncTaskLoader....so on orientation change that context is destroyed and new context(i.e activity is recreated)...so please the check the usage of context properly...i mean you need to again pass the new context to AsyncTaskLoader – Shadow Droid Nov 06 '15 at 17:09
  • When I rotate the device, I supose the loader constructor is not re-called if I call initLoader() instead restartLoader().The Loader then has a reference to the old object in the old activity, is this true? Must I implement a setter in the loader to put the object? – Ainun Nov 06 '15 at 17:44
  • please add the code to the question – Shadow Droid Nov 07 '15 at 11:33

0 Answers0