My guess would be that you have an SQLite cursor that you're not
releasing when your Activity loses focus. I believe you have two
options.

You say that you've tried to handle this in callback functions
onRestart, onResume, etc. The problem is you're looking at the wrong
end of the lifecycle. When the user hits the 'back' key, onPause is
called. In onPause you should handling releasing resources and any
other tear-down you need to do. I'd suggest reviewing the Activity
lifecycle information ( 
http://code.google.com/android/reference/android/app/Activity.html
) .

The other option is to use a managed cursor. To do this call
Activity.startManagingCursor(yourCursor).

Cheers,
Justin
Android Team @ Google

On Aug 19, 7:16 am, simon <[EMAIL PROTECTED]> wrote:
> Hi all!
> First of all i wanted to say thank you to Google for the new SDK!
> Lookin forward to the phones!
>
> now to my problem:
> as soon as i push the back button in some of my application's
> activities, i get the following error:
>
> 08-19 14:10:13.050: ERROR/AndroidRuntime(1183): Caused by:
> java.lang.IllegalStateException: attempt to acquire a reference on a
> close SQLiteClosable
> 08-19 14:10:13.050: ERROR/AndroidRuntime(1183):     at
> android.database.sqlite.SQLiteClosable.acquireReference(SQLiteClosable.java:
> 31)
> 08-19 14:10:13.050: ERROR/AndroidRuntime(1183):     at
> android.database.sqlite.SQLiteProgram.compile(SQLiteProgram.java:109)
> 08-19 14:10:13.050: ERROR/AndroidRuntime(1183):     at
> android.database.sqlite.SQLiteQuery.requery(SQLiteQuery.java:129)
> 08-19 14:10:13.050: ERROR/AndroidRuntime(1183):     at
> android.database.sqlite.SQLiteCursor.requery(SQLiteCursor.java:389)
> 08-19 14:10:13.050: ERROR/AndroidRuntime(1183):     at
> android.database.CursorWrapper.requery(CursorWrapper.java:214)
> 08-19 14:10:13.050: ERROR/AndroidRuntime(1183):     at
> android.app.Activity.performRestart(Activity.java:3330)
> 08-19 14:10:13.050: ERROR/AndroidRuntime(1183):     at
> android.app.Activity.performResume(Activity.java:3350)
> 08-19 14:10:13.050: ERROR/AndroidRuntime(1183):     at
> android.app.ActivityThread.performResumeActivity(ActivityThread.java:
> 2482)
> 08-19 14:10:13.050: ERROR/AndroidRuntime(1183):     ... 10 more
>
> What does that mean? and is there a workaround? i already tried
> different callback functions (onRestart(), onResume(),
> onRestoreInstanceState()) but none gets called before the error
> occurs. how can i do something before that error occurs? and what
> should i do against it once i get a callback? i don't understand the
> error message. it worked on m5, but 0.9 just won't do it.
>
> please help me. Thanx a lot!
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new Android 0.9 SDK beta!
http://android-developers.blogspot.com/2008/08/announcing-beta-release-of-android-sdk.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to