If think I'll need to go with the flagging approach. Seem the more
'elegant' way to do this. Thanks for your help Kostya (As usual :>)

On 2 Lut, 14:56, Kostya Vasilyev <[email protected]> wrote:
> Adam,
>
> Thread not stopping right away is normal, since a thread is there so it
> can do its own thing.
>
> Just make sure that your thread function checks the handler or a boolean
> flag or whatever as often as it can, and stops after it's been set -
> this includes before connecting.
>
> You can also close the socket from the UI thread, which will cause the
> current network operation in the worker to fail with an IO exception.
>
> -- Kostya
>
> 02.02.2011 15:35, Serdel пишет:
>
> > Thank you Kostya. As you have nicely noticed my network code doesn't
> > 'see' any flag so that's not an option for me. Setting the handler to
> > null actually came to my mind but it seem a little bit 'dirty'.  What
> > worries me is that if I exit my application, the thread is still
> > working, trying to connect and only after finishing that it can 'see'
> > that it was stopped from outside and doesn't want to communicate with
> > UI :/
>
> --
> Kostya Vasilyev -- WiFi Manager + pretty widget 
> --http://kmansoft.wordpress.com

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