Okay, problem solved. Due to a bit of careless programming by yours truly ;)
the database was closed down when it shouldn't have been, so it simply
wasn't open at the point, where the requery happened.
Best regards, Mads

On Thu, Jan 8, 2009 at 8:01 PM, Mads <> wrote:

>
> I have an Activty containing a ListView attached to a
> SimpleCursorAdapter. A longclick on one item in the ListView will make
> a context menu appear.
>
> I can update the ListView by doing a requery and then a
> notifyDataSetChanged, when the underlying cursor has changed, so
> everything works as expected there. :)
>
> My problem occurs, when I have longclicked an item, had the context
> menu in focus and then go back to the activity. Now, when I try to
> requery and do notifyDataSetChanged, the ListView doesn't update
> anymore. The log shows the following error message: "invalid statement
> in fillwindow"
>
> Looking at the code, I can see that it occurs somewhere in
> android_database_SQLiteQuery.cpp:
>
> static jint native_fill_window(JNIEnv* env, jobject object, jobject
> javaWindow,
>                               jint startPos, jint offsetParam)
> {
>    // Code removed
>    sqlite3_stmt * statement = GET_STATEMENT(env, object);
>    // Code removed
>
>    if (statement == NULL) {
>        LOGE("Invalid statement in fillWindow()");
>        jniThrowException(env, "java/lang/IllegalStateException",
>                          "Attempting to access a deactivated, closed,
> or empty cursor");
>        return 0;
>    }
>
>    // etc etc..
>
> I am not sure if that is where the problem actually occurs, but maybe
> someone has seen this before and perhaps explain how it can be that
> the cursor becomes deactivated, closed or empty when opening a context
> menu? Going to the home screen and back into the application isn't a
> problem.
>
> Best regards, Mads Kristiansen
>

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