开发者

How to Handle in code IllegalStateException on Cursor?

开发者 https://www.devze.com 2022-12-22 08:55 出处:网络
When I was debugging my application suddenly this error popup. How can I handle this kind of error? I don\'t know where and how is caused.

When I was debugging my application suddenly this error popup. How can I handle this kind of error?

I don't know where and how is caused.

Daemon System Thread [<5> HeapWorker] (Suspended (exception IllegalStateException)) 
    SQLiteCursor.finalize() line: 603   
    NativeSt开发者_Go百科art.run() line: not available [native method]   


Use managedQuery() function to query the data. If you use managedQuery() instead of query() then Activity will keep the reference of the Cursor and automatically close it when it is not used.


I had this same 2 line Exception and stack trace when using a SQLiteDatabase Cursor because I forgot to close the cursor after populating a local database structure.

0

精彩评论

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

关注公众号