android的sqlite的应用程序被强制关闭的设备
我使用SQLiteOpenHelper类来创建,打开数据库。我的应用程序我创建这我使用的读取和写入数据到数据库可写的对象SQLiteDatabase。这个对象是静态的主类,并在所有的应用程序用来读取写入数据库。我的应用程序在仿真器正常工作。但设备后,一些读写查询火灾。它为什么发生,请如果任何一个有解决方案,帮助我。
I am using SQLiteOpenHelper class to create, open database. for my application i am creating writable object SQLiteDatabase which i am using to read and write data to database. This object is static for main class and used in all application to read write in to database. my application is working properly on emulator. but on device after some read write query fires. why it is happening, please if any one has solution help me.
我在几个星期前有同样的问题,我发现这个的页面,这到底是什么是错误的。 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