In your code, you're leaving the cursor open if the query result count is 0. Hence, the leak.
-- Kostya 2011/4/4 Tobiah <[email protected]> > I googled for this, and there are lots of hits, but not, as it seems, > for the same reason that I'm getting it. I made an SQLite db using > DatabaseHelper as outlined in the docs. I have some convenience > wrappers so that I can do quick one line queries of various types. > For example: > > public String atom(String query, String[] args){ > Cursor c = db.rawQuery(query, args); > if(c.getCount() == 0){ > return null; > } > c.moveToPosition(0); > String answer = c.getString(0); > c.close(); > return answer; > } > > The error in the logs goes on to say: > > Application did not close the cursor or database object that was opened > here. > > But I'm calling .close() on the cursor. > > The error points out the function above as the cause. The database handle > lives in a subclass of Application() that is accessible to all > activities that need the database. > > Thanks for any help. > > Tobiah > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected] > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

