I think this is your code here:

$MyCursorHelper$MyContentObserver.onChange(CursorTreeAdapter.java:503)

Looks like when you switching between activities and multiple data
population tasks are going on, they have conflicting Cursor state in
your onChange method.  You might want to use a static flag to
indicating the cursor operation state or something like that, or
synchronize the block.

On Tue, Jul 28, 2009 at 7:49 AM, Al Sutton<[email protected]> wrote:
>
> I keep hitting something which makes me wonder if I'm doing something
> wrong.
>
> I have a few Activities, each of which has a ExpandableList and a
> ResourceCursorTreeAdapter which is given a cursor from
> Activity.managedQuery when the adapter is created in the onCreate
> method of the activity.
>
> There is also a service which updates the data that the
> ResourceCursorTreeAdapter has a Cursor to via the datas
> ContentProvider. When there is no data in the provider the service may
> download around 100 records and perform inserts. The ContentProvider
> does fire a notifyChange on each insert.
>
> If I run the application in the emulator and switch between the
> activities whilst the ContentProvider is populated I can sometimes
> trigger the exception at the end of this email. If I wait until
> everything has been populated I can't trigger the problem.
>
> The confusing part is that the stack trace doesn't doesn't reference
> my code in any way.
>
> Anyone have any suggestions?
>
> Al.
>
> -- Exception --
> E/AndroidRuntime(  297): java.lang.IllegalStateException: attempt to
> acquire a reference on a close SQLiteClosable
> E/AndroidRuntime(  297):        at
> android.database.sqlite.SQLiteClosable.acquireReference
> (SQLiteClosable.java:31)
> E/AndroidRuntime(  297):        at
> android.database.sqlite.SQLiteProgram.compile(SQLiteProgram.java:109)
> E/AndroidRuntime(  297):        at
> android.database.sqlite.SQLiteQuery.requery(SQLiteQuery.java:130)
> E/AndroidRuntime(  297):        at
> android.database.sqlite.SQLiteCursor.requery(SQLiteCursor.java:389)
> E/AndroidRuntime(  297):        at
> android.database.CursorWrapper.requery(CursorWrapper.java:211)
> E/AndroidRuntime(  297):        at android.widget.CursorTreeAdapter
> $MyCursorHelper$MyContentObserver.onChange(CursorTreeAdapter.java:503)
> E/AndroidRuntime(  297):        at android.database.ContentObserver
> $NotificationRunnable.run(ContentObserver.java:43)
> E/AndroidRuntime(  297):        at android.os.Handler.handleCallback
> (Handler.java:542)
> E/AndroidRuntime(  297):        at android.os.Handler.dispatchMessage
> (Handler.java:86)
> E/AndroidRuntime(  297):        at android.os.Looper.loop(Looper.java:
> 123)
> E/AndroidRuntime(  297):        at android.app.ActivityThread.main
> (ActivityThread.java:3739)
> E/AndroidRuntime(  297):        at
> java.lang.reflect.Method.invokeNative(NativeMethod)
> E/AndroidRuntime(  297):        at java.lang.reflect.Method.invoke
> (Method.java:515)
> E/AndroidRuntime(  297):        at com.android.internal.os.ZygoteInit
> $MethodAndArgsCaller.run(ZygoteInit.java:739)
> E/AndroidRuntime(  297):        at
> com.android.internal.os.ZygoteInit.main(ZygoteInit.java:497)
> E/AndroidRuntime(  297):        at dalvik.system.NativeStart.main
> (Native Method)
>
>
> >
>

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