SQLite has locking on by default and you can have any number of
threads accessing it concurrently if you leave it in locking mode.
Opening and closing the database and/or the cursors is not especially
expensive. One trick that improves performance is to re-use the cursor
after you close it so the object doesn't have to be rebuilt. Something
like this:

// cursor used here

// Now finished with cursor
theCursor.close();
theCursor = someDbAccessMethod();
// More work with new cursor

For example, I might have 5 or 6 methods in a given Activity that all
re-use the same cursor as long as I'm sure my logic does not require
two of them to use the cursor at the same time. Then the cursor object
is only created in onCreate.

-- 
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

Reply via email to