I'm getting an Unable to destroy activity xxx: android.database.sqlite.SQLiteException: unable to close due to unfinalised statements error while my activity is being destroyed. I presume this is because I'm performing database operations from within AsyncTasks and they are somehow being killed before completion.
How can I ensure that my AsyncTasks actually complete before the activity is stopped? Incidentally, I thought that an AsyncTask can't be explicitly killed without the AsyncTask agreeing to do so by checking.
It may be relevant that this error is occurring during Robotium integration testing. I suspect it's happening after the test is completed and the test calls Robotium.finishOpenedActivities(). My guess is that somehow the AsyncTask is being forcefully killed mid-execution if this is possible (though I don't explcitly support cancellation in my AsyncTask implementation). Additionally, I use OrmLite for my database access.