When should I close the DatabaseHelper?

前端 未结 1 1210
耶瑟儿~
耶瑟儿~ 2021-01-14 08:48

With reference to this link, when is a good time to close the connection if you only have one connection? I have a service running in the background at all times. When is a

1条回答
  •  太阳男子
    2021-01-14 09:17

    You do not actually have to call close(). For example, if you implement a content provider, there is no opportunity to call close(). We have been told that, due to the way SQLite is implemented, not calling close() will not cause any particular problem.

    That being said, you really should reconsider having "a service running in the background too all the time".

    0 讨论(0)
提交回复
热议问题