SQLiteException Unable to close due to unfinalised statement

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

SQLiteException Unable to close due to unfinalised statement

Postby victoheart » Thu Jan 21, 2010 11:45 am

Hi all,

I'm developing an app which involvels too many database operations(insertion & retrievel).

The problem is about Cursor and Contact Provider. The SQLiteException shows Unable to close due to unfinalised statement. It happened in the following code.

if(mObserverRegistered){
mObserverRegistered = false;
mContactsListCursor.unregisterContentObserver(mObserver);
^^^^^^^^^^^^^^^^^^^^^^^
}
if(mContactsListCursor != null)
mContactsListCursor.close();

mContactsListCursor = cursor;

if(cursor != null){
Log.d(TAG, "observer registered");
mContactsListCursor.registerContentObserver(mObserver);
mObserverRegistered = true;
}


The Exception shows in the following.

Does anybody know how to solve problem?

Thank you.

Uncaught handler: thread main exiting due to uncaught exception
java.lang.RuntimeException: Unable to stop activity
{com.android.contacts/com.android.contacts.ContactsListActivity}:
android.database.sqlite.SQLiteException: Unable to close due to unfinalised statements
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3324)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3390)
at android.app.ActivityThread.access$2700(ActivityThread.java:116)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1834)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4211)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.database.sqlite.SQLiteException: Unable to close due to unfinalised statements
at android.database.sqlite.SQLiteDatabase.dbclose(Native Method)
at android.database.sqlite.SQLiteDatabase.onAllReferencesReleased(SQLiteDatabase.java:241)
at android.database.sqlite.SQLiteClosable.releaseReference(SQLiteClosable.java:42)
at android.database.sqlite.SQLiteProgram.onAllReferencesReleased(SQLiteProgram.java:67)
at android.database.sqlite.SQLiteClosable.releaseReference(SQLiteClosable.java:42)
at android.database.sqlite.SQLiteProgram.close(SQLiteProgram.java:221)
at android.database.sqlite.SQLiteQuery.close(SQLiteQuery.java:141)
at android.database.sqlite.SQLiteCursor.close(SQLiteCursor.java:507)
at android.database.CursorWrapper.close(CursorWrapper.java:45)
at android.content.ContentResolver$CursorWrapperInner.close(ContentResolver.java:800)
at com.android.contacts.ContactsListActivity$ContactItemListAdapter.changeCursor
(ContactsListActivity.java:2393)
at com.android.contacts.ContactsListActivity.onStop(ContactsListActivity.java:1053)
at android.app.Instrumentation.callActivityOnStop(Instrumentation.java:1245)
at android.app.Activity.performStop(Activity.java:3680)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3319)
victoheart
Freshman
Freshman
 
Posts: 4
Joined: Wed Jan 20, 2010 9:02 am

Top

Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 5 guests