我是否缺少 close()
?
好的,我的模拟器出现错误,但它不会强制关闭。这是一个 PID 为 651 的游标 Invalid Starement in fillWindow()
。我知道它与我的数据库游标有关。我的 ListView 由 startManagingCursor(c)
填充,但我不确定是否需要关闭它,因为我没有使用托管查询。
在我的 onCreate 中有
db = new DBase(this);
db.open();
fillData();
db.close();
在我的 onResume 中有
db.open();
fillData();
db.close();
我试过将 db.close();
放在我的 onDestroy 中,它仍然会抛出该错误。
最佳答案
创建时
db = new DBase(this);
db.open();
fillData();
在恢复时
fillData();
销毁
db.close();
成功了。
关于android - fillWindow() 中的无效语句,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9049542/