Thursday, June 17, 2010

[android-developers] SQLiteCursor on that has not been deactivated or closed

I've followed the try/finally approach but still get this error.

Is there anything else that can be done?

Here is what I have.

MediaDbAdapter mDbHelper = null;
Cursor c = null;
try {
mDbHelper = new MediaDbAdapter(ctxt);
mDbHelper.open();
c = mDbHelper.findByX(data.getX());
if(c != null) {
//Do an Update on the database
}
else if(c == null) {
//Do an Insert on the database
}
} finally {
if(c != null) {
c.deactivate();
c.close();
c = null;
}
if(mDbHelper != null && mDbHelper.isOpen()) {
mDbHelper.close();
}
}

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment