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:
try db.BeginTransaction db.RunCommand(insert or update etc.) db.CommitTransaction catch db.RollbackTransaction Evgeny On Sun, May 9, 2010 at 8:18 AM, Senthil ACS <acs....@gmail.com> wrote: > For insert() and update(), have it under synchronized blocks. > > On May 8, 5:40 pm, Thierry Legras <tleg...@gmail.com> wrote: > > Hi, > > > > I have an application with several tables, each being updated by > AsyncTask > > fired by different Activities and used by UI with SimpleCursorAdapter. > > Though i am not developping a game, I would like to avoid to interrupt > the > > user as mush as possible. > > Has SQLite is not multiaccess proof, what is the best way of handling > such > > situation? > > > > - I consider adding lock from each DB open and to each close sequence but > > this seems quite subject to bugs > > - The solution i am using now is that each DB access (read/write) is done > in > > UI thread (when AsyncTask completes, DB write is done typically in > > onPostExecute), but that means user is blocked for several seconds during > > the DB write. > > > > Is there any better solution for that? Should i use a ContentProvider? > when > > i read "Content providers store and retrieve data and make it accessible > to > > all applications", this does not seems to be what i need. Any idea? > > > > -- > > Thierry. > > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to android-developers@googlegroups.com > > To unsubscribe from this group, send email to > > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > > For more options, visit this group athttp:// > groups.google.com/group/android-developers?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to android-developers@googlegroups.com > To unsubscribe from this group, send email to > android-developers+unsubscr...@googlegroups.com<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en