Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个定期下载联系人的应用程序(使用服务和异步任务),但同时我阅读了已经下载的联系人。
我的问题是,当我下载联系人时,我尝试读取数据库,应用程序崩溃。
有人可以向我解释如何同时读取和写入数据库。
任何帮助将非常感激。
为什么不尝试仅用于读取的数据库助手的getReadableDatabase()和相同的getWritableDatabase()以写入。可能这会奏效。
我希望你已经正确实现了 onUpdate 方法,这可能会导致一些严重的数据损坏。