I need to do writing into the database from different AsyncTask threads but the problem is that we need to be sure that at one time only one thread should be in the process of writing into the db? 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 ? Thanks
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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 ?
Yes, it will.