java.lang.IllegalStateException: attempt to re-open an already-closed object

后端 未结 2 1706
攒了一身酷
攒了一身酷 2021-01-14 04:39

I\'m trying to figure out why occasionally I\'m getting the IllegalStateException. I can\'t find any good examples that show how to load a list using a thread to query a SQ

2条回答
  •  悲&欢浪女
    2021-01-14 05:04

    Look into AsyncQueryHandler if you want to query DB the way you want.

    Your task RetrieveCursorTask is running on separate thread so when your activity gets destroyed your AsyncTask might still be running in background but as you have closed your cursor in main activity onDestroy it might be requeried again after your AsyncTask returns.

提交回复
热议问题