When should I close the DatabaseHelper?
With reference to this link, when is a good time to close the connection if you only have one connection? I have 开发者_JAVA百科a service running in the background at all times. When is a good time to call the close()
function? Any suggestions?
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".
精彩评论