Maurice Maurice - 1 year ago 66
Android Question

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 a service running in the background at all times. When is a good time to call the

function? Any suggestions?

Answer Source

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".