문제

Do I need to be concerned about making sure the database is closed when a FragmentActivity that uses a LoaderEx SQLiteCursorLoader is paused or destroyed?
Thanks much

도움이 되었습니까?

해결책

When the FragmentActivity is destroyed, it should call reset() on all Loader instances it created, which will call onReset() in the Loader implementation, which in SQLiteCursorLoader calls close() on any outstanding Cursor.

Note that this happens when the activity is destroyed. There does not seem to be a Loader equivalent of the managed Cursor concept of deactivating the Cursor when the activity is paused. That's a pity, as that was a nice heap management feature, and I'll ponder how to best support that.

If you find evidence that something is being leaked, file an issue in the LoaderEx project with details of how to reproduce the error.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top