IllegalStateException: database already closed (using ViewPager)

巧了我就是萌 提交于 2019-12-05 11:06:20

this exception actually is raised because you double close your database, not because you did not close it.

so..

in you close() method, replace the following line in your code:

if (db != null) {

with:

if (db != null && db.isOpen()) {

Make your DbHelper a singleton, as described in this post.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!