本文介绍了Android的时候,关闭DatabaseHelper?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参照此链接忙超时的SQLite在Android ,当是一个很好的时间来关闭连接,如果所有的u已经是1个连接?我在后台运行过的所有时间的服务,所以不知道哪里是好调用close()。谢谢!

With reference to this link Busy timeout for SQLite on Android, when is a good time to close the connection if all u have is 1 connection? I have a service running in the background too all the time, so was wondering where is good to call the close(). Thanks!

推荐答案

您实际上并不需要调用关闭()。例如,如果实现内容提供商,也没有机会打电话关闭()。我们被告知,由于SQLite的方式实现的,而不是调用关闭()不会引起任何特别的问题。

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

这篇关于Android的时候,关闭DatabaseHelper?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 18:28