Kostya, how many users do use your app?
Cause my version works ok for me and for most my users. But some of
them keep getting such error.

I think, this problem is related to some devices, not every.
Or, may be some very specific cases.

Also, do your background threads use ContentProvider to insert/update
data?
Or just interface?

DanH, I don't get this exception every time (as Kostya said too),
  so it's ok keeping Cursor open

And, I'll try to do this with ContentProviders )

On 7 апр, 15:41, Kostya Vasilyev <kmans...@gmail.com> wrote:
> 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<evgeny.n...@gmail.com>  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 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