That's not what I'm seeing with my current project.
My UI code uses a LiveView with a CursorAdapter, and has background
threads that access and write to the database, sometimes using
transactions, sometimes not.
I've never seen a "database locked" exception, even when triggering a
background thread to do its thing while I have a cursor-based ListView
on the screen.
One possible difference is that my ListView gets its cursor through a
ContentProvider.
Another possible difference is that my UI code and worker threads are
all within the same process, and they all use the same SQLiteDatabase
object, so the DB is only open once.
-- Kostya
07.04.2011 15:17, DanH пишет:
The problem is that when you "hold the cursor open" the database is
locked. That feature is not really applicable to a multi-threaded SQL
environment.
On Apr 7, 1:01 am, Evgeny Nacu<[email protected]> wrote:
> Hi again!
>
> DanH, I use thread synchronization. It works well.
> But, as I told in my first post, there are some problems:
>
> The biggest problem: I can't use Cursor for my ListAdapter and
> ExpandableListAdapter
> I've got to use something like ArrayAdapter, read all data from cursor
> to java objects at one time.
>
> But, as I understand, CursorAdapter works better cause it can hold
> cursor open and scroll through cursor and read data when needed
> It works faster for me.
>
> So, also, here is new exception I've got today.
> I retried to implement UI handling with Cursor. And I've got
> SQLiteException: database is locked: BEGIN EXCLUSIVE;
>
> Who knows how to handle it?
--
Kostya Vasilyev -- http://kmansoft.wordpress.com
--
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