SQLite & concurrent access best practices

by Evgeny V » Sun, 09 May 2010 15:06:59 GMT

Sponsored Links
 I believe you can provide the safe concurrency managment by using DB
transactions. Since you don't care about sequence between separate
activities you can run following snippet:

 db.RunCommand(insert or update etc.)


> >

SQLite & concurrent access best practices

by Thierry Legras » Mon, 10 May 2010 06:02:38 GMT

 Thank you both for your answers.

Are you sure using synchronized is enough inside the insert or update? I
also got exceptions in call to getReadableDatabase while another thread was
being writing so i don't think it would work. I am already using transaction
for DB write but it did not seem to make any changes.

The way i do each time i need to read/write/update DB is something like

OnRead() {
 db = new myDBHelperClass();

OnWrite() {
 db = new myDBHelperClass();

I was rather thinking of using a synchronized in OnRead and OnWrite, but has
such methods exists in differents Activities and Task, i am pretty reluctant
to do that.

I also so design were DB is open in Activity onCreate and closed in
onDestroy, but i guess i will not work when a task also needs write in the
DB while the DB is open by the activity.

2010/5/9 Evgeny V <evgen...@gmail.com>




Sponsored Links

Other Threads

1. How do you detect target platform characteristics?

Is there an API for interrogating the handset for physical and
operating characteristics such as number/type of buttons, QWERTY,
accelerometer, screensize, etc. Is there any minimum set of features
that Android apps can assume to be present on a handset?


2. Creating the Dynamic tabs from other Activity

I am implementing the small messenger application.
for that i need to create the dynamic tabs for the chat conversation.
What i am doing is
I was created the login page and after that i am able to display the
buddies in the list view.
I need to create the tab page
if i go back and select the other buddy then i have to show the two
tabs (previous one and the new one).
But i am unable to create the two tabs. while calling the startActivity
() from the Buddlist screen.

Can anybody please help me how to create the dynamic tabs from the
other activity.


3. +1

4. Posting AlertDialogs from the Options Menu?

5. Does one really need to have a data plan with G1 if you use Wifi + voice?

6. How to make surfaceview insensitive to touch Events

7. HttpClient4 execute(HttpPostMethod) failed