I would recommend having a singleton that all of the clients go through,
which takes care of keeping the database open as long as there are clients
of it.

On Wed, Jan 21, 2009 at 2:45 PM, polo777 <[email protected]> wrote:

>
> Hi everyone,
>
> I have two threads:
> - the main one in charge of the UI
> - a second one that takes care of network calls, parsing responses and
> database updates.
>
> The main threads open the database, retrieves information into a
> Cursor that is used to feed a listView.
>
> My problem is the following: When I close the application the activity
> is destroyed, the second thread can still be running and thereby still
> can update the DB. Since the main thread open the DB, I want to close
> it to do the stuffs properly.
>
> However if I close it within the onDestroy method and if the second
> thread is running and is about to update the DB, I get an error.
>
> What is the best way to handle this situation?
>
> Thanks a lot
> Polo
> >
>


-- 
Dianne Hackborn
Android framework engineer
[email protected]

Note: please don't send private questions to me, as I don't have time to
provide private support.  All such questions should be posted on public
forums, where I and others can see and answer them.

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