Reputation: 91
I'm trying to solve a db locked problem . My application downloads data and write them to database at start up . I made a thread do the writing in a transaction . But , when the data's amount is huge , the writing will not complete so quickly and during the that , reading data of the same table will cause a db locked error . Anybody has idea to solve this ?
Upvotes: 0
Views: 94
Reputation: 34823
DB Locked error can be avoid by using synchronized methods
I prefer you to use ContentProvider here.
Even though its mainly aimed to share among applications, It can be used inside our single app.
If we use content provider, there is no worries of closing and locking of db.
Refer Simple Content Provider for db operations
Upvotes: 1