我需要从不同的 AsyncTask 线程写入数据库,但问题是我们需要确保在写入数据库的过程中一次只有一个线程?我的问题是,如果我使用单例模式在整个应用程序中创建 SQLiteDatabase 对象的单个实例,那么该单个实例是否会管理不同线程之间的同步? 谢谢
最佳答案
My question is if i use the singleton pattern in making the single instance of SQLiteDatabase object all over the application,will that single instance manage the synchronization between different threads or not ?
是的,会的。
关于android 可以 SQLiteDatabase 的单个实例管理多个线程之间的同步吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17674182/