For basic functionality, you only need to override loadInBackground.
If i only override loadInBackground, will there be any problem, I mean
if Activity quit, will the loadInBackground still continue to execute
coz I can see the AsyncTask will.
The AsyncTaskLoader will continue to load in background on Activity quit.
The only thing AsyncTaskLoader provides over AsyncTask is that, AsyncTaskLoader would know whether the task has been run / is running on Activity recreate, and attach to the existing task or recover the result without rerun the AsyncTask, e.g. on screen rotation. Given that you use LoaderManager.initLoader()
, LoaderManager.resetLoader()
correctly
Edit:
The AsyncTaskLoader need a whole structure, i.e. AsyncTaskLoader
, LoaderManager
, LoaderManager.LoaderCallbacks