Even with that I still get this error: INFO/dalvikvm(23250): Uncaught exception thrown by finalizer (will be discarded): INFO/dalvikvm(23250): Ljava/lang/IllegalStateException;: Finalizing cursor android.database.sqlite.sqlitecur...@44887dc8 on media that has not been deactivated or closed INFO/dalvikvm(23250): at android.database.sqlite.SQLiteCursor.finalize(SQLiteCursor.java:596) INFO/dalvikvm(23250): at dalvik.system.NativeStart.run(Native Method)
I don't know how to get rid of this, I've looked everywhere I can think of for a solution. On Jun 18, 3:44 am, Moss <b.thax....@gmail.com> wrote: > I always do like this: > > MediaDbAdapter mDbHelper = null; > Cursor c = null; > > try { > // Do you DB stuff} catch( Exception e) { > > // Something went wrong > > } > > // Close and cleanup > if ( c != null ) > { > // You do not need to deactivate the cursor > c.close();} > > if(mDbHelper != null && mDbHelper.isOpen()) > { > mDbHelper.close(); > > } > > On Jun 17, 10:31 pm, gcstang <gcst...@gmail.com> wrote: > > > > > 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en