请看这段代码,它从官方文档中提取出来。 http://developer.android.com/reference/android/content/AsyncTaskLoader.html
@Override public void deliverResult(List<AppEntry> apps) {
if (isReset()) {
// An async query came in while the loader is stopped. We
// don't need the result.
if (apps != null) {
onReleaseResources(apps);
}
}
当Loader完成其工作并需要将数据发送回UI线程时,将调用此方法。我的问题是:为什么我们要询问Loader是否已重置?重置它的含义是什么?该类声明如下:
/**
* Return whether this load has been reset. That is, either the loader
* has not yet been started for the first time, or its {@link #reset()}
* has been called.
*/
如果加载器从未第一次启动,您会认为它会停留在STOPPED状态,为什么要重新启动?
我想我真的不太了解加载器如何响应Activity生命周期,但文档中没有提到任何内容。