Android - sqlite content providers and multithreading

Viewed 6149

I'm a little confused about content providers. If I have multiple activities in my application do they each get their own instance of the content provider? it's just essentially a class/interface?

In one activity I will have many threads simultaneously writing to the database. How do I deal with allowing one thread to write at a time?

Do I just catch SQLiteDatabaseLockedException, put the thread to sleep then retry? Or is there a better way?

Are the database locks released when an activity pauses/is destroyed? If so could I just create a synchronized lock against the content provider itself?

3 Answers
Related