[android-developers] Re: Thread stopping

2009-02-18 Thread dillirao malipeddi
Thank you all it's works cool with your Suggestions, it helps a lot. On Wed, Feb 18, 2009 at 9:43 PM, Blake B. wrote: > > You don't need to do anything complicated - use Handler.postDelayed > (Runnable r, long delayMS) like Stoyan mentioned. > > Be sure to keep a reference to your Runnable r so

[android-developers] Re: Thread stopping

2009-02-18 Thread Blake B.
You don't need to do anything complicated - use Handler.postDelayed (Runnable r, long delayMS) like Stoyan mentioned. Be sure to keep a reference to your Runnable r so you can call removeCallbacks(r) like Romain mentioned when your activity is pre- empted before the posted Runnable executes. Thi

[android-developers] Re: Thread stopping

2009-02-18 Thread Stoyan Damov
...or take care of threading properly - instead of Thread.sleep, use a monitor and wait on it with a timeout. Here's the pseudo code (catching InterruptedException omitted): // in your main thread // when you launch the secondary thread make sure it's running before you do anything else synchron

[android-developers] Re: Thread stopping

2009-02-17 Thread Romain Guy
In your application's onPause/onStop/onDestroy simply use Handle.removeCallbacks(Runnable). On Tue, Feb 17, 2009 at 9:46 PM, Dilli wrote: > > Hi all, > > > I am developing a simple application with thread concept > > problem: > > In one thread i write > > { > Thread.sleep(1000