Hi,
I did a bit of reading on this subject, and there have been quite a few mail 
chains which have touched upon this as a side note, however, I couldn't find 
any of them which gave a definitive answer to this particular question.
*Is it possible to do sqlite operations in a background thread using the 
SqliteDatabase and Cursors on android?*

Creating a database requires a Context, which could mean that it is meant to 
be done in the UI thread only. Can I create a database object in the UI 
thread using the Context that I have there, and then pass it to the 
background thread for it to use? I will probably have to do my own 
synchronization of the database object, but will it lead to any other 
problems?

My application spawns a lot of background threads (which extend 
java.lang.Thread). These threads need to read and update an SQL database 
occasionally. This job cannot be moved to the UI thread (although the UI 
thread might also update the SQL database independently).

Please let me know if it is OK to create a database object in the UI thread 
using the UI thread's context, and then use it in the background thread.

If not, then I have another approach in mind (spawning sqlite3 and using a 
pipe to give input to it and read from it), however I don't want to go that 
way as it is clumsy.

Any information will be much appreciated.

Thanks and regards,
Rajbir Bhattacharjee

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to