Activity Not Properly Managing Cursor.
Solution 1:
Try closing the cursor in the onPause()
(cursor.close()
). If you are using a SimpleCursorAdapter
you should also detach the cursor from the adapter.
You can requery for the cursor in the onResume()
method if you wish.
Solution 2:
Well, it turns out that Cursor.requery() is depreciated and I was getting the same error every time I tried to call it. startManagingCursor() was calling requery, as I suppose it should, and that in turn was causing my problems there... I'm not sure why requery is causing an error in this instance, I've used it successfully before.
I ended up rearranging some code, and putting my cursor = SQLHelper.getwhatevercursor() code into onResume() instead of onCreate, as onResume is called right after onCreate anyway. As recommended by Nikola I am also closing the cursors in onPause().
This seems to be working now...
Post a Comment for "Activity Not Properly Managing Cursor."