On Thu, Dec 1, 2011 at 9:46 AM, HighFlyer <[email protected]> wrote:
> I have large database which should be updated periodically. Update
> process is long enough and takes up to 10 seconds.
> Also I have one ListView with short description of objects. On item
> click activity with full object info should be shown.
> The problem is: object information storing in database and if update
> is performing its impossible to read necessary data due to locks in
> Java access layer to database.
> There are two cases: I may block UI until update finished, or
> information activity may be shown with empty labels and fills after
> update process finished.
> Both variants seems ugly to users.
>
> To reduce lock times, I make copy of *.db file, apply update data to
> it, and after INSERT and UPDATE statements completed, swaps original
> and updated *.db files. This technique reduce lock time to ~50 ms. But
> it increases total update time up to 5 seconds.
>
> Do you know other practices to deal with such situations?

Do the updates in smaller chunks that take less individual time, to
allow other threads read access to the content in between those
chunks.

> Maybe right
> solution is to implement Java wrapper on SQLite native functions
> without thread locks?

Um, no.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

Warescription: Three Android Books, Plus Updates, One Low Price!

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