Hi,
I am currently doing an app that asynchronously populates a list view
at startup using AsyncTask.
Therefore the AsyncTask uses SQLiteOpenHelper.getReadableDatabase to
read some data.
At the app's shutdown (onPause) the UI thread is writing some new data
to the database after using SQLiteOpenHelper.getWriteableDatabase.
Since I saw some exceptions on logcat because I forgot to close the
database I now close it in both the AsyncTask and the UI thread when
done with it.

The question now is if this is correct. Is it a problem when the
AsyncTask is interleaved with the UI thread writing the database?
Is the db reference returned from SQLiteOpenHelper.getReadableDatabase
still valid after calling SQLiteOpenHelper.getWriteableDatabase from
the UI thread? Is it okay that both threads close the database?
When reading the manual I think this is not correct. But how should it
be done?

Thanks in advance,
Daniel
--~--~---------~--~----~------------~-------~--~----~
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