android - Database error in logcat -
i working on application , works fine in log can see below mentioned error: please suggest reason behind , how fix this.. have closed cursors , closing database connection after use. please help...
12-02 17:16:48.500: error/database(388): close() never explicitly called on database '/data/data/com.example.my/databases/my.db' 12-02 17:16:48.500: error/database(388): android.database.sqlite.databaseobjectnotclosedexception: application did not close cursor or database object opened here 12-02 17:16:48.500: error/database(388): @ android.database.sqlite.sqlitedatabase.(sqlitedatabase.java:1810) 12-02 17:16:48.500: error/database(388): @ android.database.sqlite.sqlitedatabase.opendatabase(sqlitedatabase.java:817) 12-02 17:16:48.500: error/database(388): @ android.database.sqlite.sqlitedatabase.openorcreatedatabase(sqlitedatabase.java:851)
you need close database activity's ondestroy method. assuming you've written application using "database helper" class, in android tutorials such notepad, ought work as-is. (otherwise, replace mdbhelper.close() appropriate call close database connection.)
public class myclass extends activity { // ... @override protected void ondestroy() { super.ondestroy(); mdbhelper.close(); } }
Comments
Post a Comment