AsyncTaskLoader onLoadFinished with a pending task and config change

后端 未结 4 1240
醉酒成梦
醉酒成梦 2021-02-02 10:11

I\'m trying to use an AsyncTaskLoader to load data in the background to populate a detail view in response to a list item being chosen. I\'ve gotten it mostly work

4条回答
  •  轮回少年
    2021-02-02 11:04

    Maybe not best solution but ... This code restart loader every time, which is bad but only work around that works - if you want to used loader.

    Loader l = getLoaderManager().getLoader(MY_LOADER);
    if (l != null) {
        getLoaderManager().restartLoader(MY_LOADER, null, this);
    } else {
        getLoaderManager().initLoader(MY_LOADER, null, this);
    }
    

    BTW. I am using Cursorloader ...

提交回复
热议问题