【发布时间】:2015-09-27 17:56:55
【问题描述】:
我正在尝试构建我的第一个应用程序,但在使用 sqlite 时遇到了困难。
我明白了
W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '/data/data/com.example.user.myApp/databases/testJavaNorm.sqlite' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '/data/data/com.example.user.myApp/databases/testJavaNorm.sqlite' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
W/SQLiteConnectionPool﹕ A SQLiteConnection object for database '/data/data/com.example.user.myApp/databases/testJavaNorm.sqlite' was leaked! Please fix your application to end transactions in progress properly and to close the database when it is no longer needed.
作为初学者,我使用了Sqlite tutorial。据我了解,我必须在 DB 类的末尾编写公共方法并像 3 中所示那样调用它。
但 Android Studio 有时会显示内存泄漏。
我注意到任何地方都没有任何 db.close。所以我在调用方法中添加了它,后来是公共方法。还是有漏的。现在我读到那个游标也必须关闭。
我是不是用错了这个教程?还是教程不好?
【问题讨论】:
标签: android sqlite memory-leaks sqliteopenhelper