且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

android的sqlite的应用程序被强制关闭的设备

更新时间:2023-10-12 16:38:22

我在几个星期前有同样的问题,我发现这个的页面,这到底是什么是错误的。 SQLite的是越野车在Android和实施了错误的方式,所以你不能有线程读取,并在同一时间写入数据库/表。结果
setLockingEnabled()只是不工作,它应该的方式。

I had the same problem a few weeks ago, and I found this page, it's exactly what's wrong. The SQLite is buggy in Android and is implemented the wrong way, so you can't have threads reading and writing to the database/table at the same time.
setLockingEnabled() just dont work the way it's supposed.

我所做的就是运行读取和写入到数据库同步,这意味着你将永远不会有在同一时间读取或写入数据的问题,不管你有多少线程具有的所有方法。

What I did was running all methods that read and write to the db "Synchronized" which means you'll never have a problem with reading or writing data at the same time no matter how many threads you have.

问候
托比亚斯

Regards Tobias