开发者

Does an Activity-managed Cursor invoke requery() on another thread?

开发者 https://www.devze.com 2023-01-16 05:43 出处:网络
From within an Activity I query my database from an AsyncTask, and I pass the result Cursor to startManagingCurso开发者_运维知识库r(). From the docs, a managed cursor will automatically invoke requery

From within an Activity I query my database from an AsyncTask, and I pass the result Cursor to startManagingCurso开发者_运维知识库r(). From the docs, a managed cursor will automatically invoke requery() when an activity is restarted.

My question is, is requery() invoked from a background thread? If not and this runs on the UI thread and the query takes a long time to return this could cause a Application Not Responding dialog, right?


The API docs were updated recently with a note about this method:

"it results in Cursor queries being performed on the application's UI thread and thus can cause poor responsiveness or even Application Not Responding errors"

http://developer.android.com/reference/android/widget/CursorAdapter.html#FLAG_AUTO_REQUERY

So it would appear that yes, requery() is not invoked from a background thread, and as the above comment says, it should not be used.

0

精彩评论

暂无评论...
验证码 换一张
取 消