02-02 14:31:34.048: WARN/SQLiteCompiledSql(359): Releasing statement in a finalizer. Please ensure that you explicitly call close() on your cursor: SELECT * FROM
02
You should reverse the close statements within your onDestroy() method. First close the cursor, then the db:
if (cursor!=null){
cursor.close();
}
if (db!=null){
db.close();
}
You basically need to reverse the order of creating/opening db and cursor.
Also note that the db/cursor in the example is opened in onCreate() which is a callback from the system. You may want to close the cursor/db before leaving that method. You are free to cache the DataSQLHelper in your application.
In my application Zwitscher, I have put the whole db/cursor handling with the methods of the SQLHelper class so that the layers above do not have to care about it. See its TweetDB class.