Android, threads and databases
I need to write some application which will have a couple threads and these threads will be work with local database. I afraid that these threads will be compete among themselves for database. Is there any simple solution to solve this problem? I read that I can use content provider becouse then will be only one connection 开发者_StackOverflow社区with database but maybe there is another solution? Thanks for all advice and tip.
Use one DataBase Helper class and create a single instance which can be accessed by both threads.
Make all the methods in DataBase Helper class as synchronized to avoid race conditions.
精彩评论