Cursor Invalid statement in fillWindow()

产生原因是不适当的关闭数据库连接,会将数据集同时关闭。应当在用完后统一关闭。

我的问题解决了, 呵呵, 如下:
1. 首先此问题发生原因是, android想使用cursor.requery(), 但是数据库连接关闭.
因为使用了startManagingCursor()函数, 按照api中描述:
This method allows the activity to take care of managing the given Cursor's lifecycle for you based on the activity's lifecycle. That is, when the activity is stopped it will automatically call deactivate() on the given Cursor, and when it is later restarted it will call requery() for you. When the activity is destroyed, all managed Cursors will be closed automatically.
可以看到, cursor声明周期将与Activity共同管理, 而当你返回List页时, 系统自动requery() 时, 我的DB连接已经关闭, 因为, 我在onStop方法中close()的.
2.解决方法, 在onDestroy中进行db close. 而且, 在从子Activity返回此parentActivity时, 也不需要renderListView(), 因为Android自动为我们从新requery啦

 

 

 

你可能感兴趣的:(Activity,数据库连接,原因,is,Managing)