[android-developers] Re: two threads, the main closes the DB but the second is still running and need to use the DB!

2009-01-23 Thread Mark Murphy
polo777 wrote: Dianne, Thanks a lot for your answers. Really helpful! Another question, just to make sure I understood what you meant: The main UI thread isn't destroyed. Well, it is destroyed when the process is killed, and at that point it doesn't matter because the entire process

[android-developers] Re: two threads, the main closes the DB but the second is still running and need to use the DB!

2009-01-22 Thread polo777
Dianne, Thanks a lot for your answers. Really helpful! Another question, just to make sure I understood what you meant: The main UI thread isn't destroyed. Well, it is destroyed when the process is killed, and at that point it doesn't matter because the entire process is gone. It means

[android-developers] Re: two threads, the main closes the DB but the second is still running and need to use the DB!

2009-01-21 Thread polo777
Another problem related to this one. When the secondary thread post back to the main thread, the main thread fetches data from the DB and update the view. Here also I got an error. It is perfectly normal since the application has been killed. How to handle that? Thanks a lot in advance. On Jan

[android-developers] Re: two threads, the main closes the DB but the second is still running and need to use the DB!

2009-01-21 Thread Dianne Hackborn
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 polodr...@yahoo.com wrote: Hi everyone, I have two threads: - the main one in charge of the UI

[android-developers] Re: two threads, the main closes the DB but the second is still running and need to use the DB!

2009-01-21 Thread polo777
Yes, I didn't think about that! That could definitely help me! But in this case: 1 - What would be the life cycle of this class singleton if the user sends the application (and so the activity that was displayed) in the background and the activity is destroyed for instance? 2 - How to make sure

[android-developers] Re: two threads, the main closes the DB but the second is still running and need to use the DB!

2009-01-21 Thread Dianne Hackborn
On Wed, Jan 21, 2009 at 5:01 PM, polo777 polodr...@yahoo.com wrote: 1 - What would be the life cycle of this class singleton if the user sends the application (and so the activity that was displayed) in the background and the activity is destroyed for instance? 2 - How to make sure this