That's right, use the flags and catch the interrupted exception..

don't use stop().

This is a huge antipattern..

kris

On Mon, Apr 30, 2012 at 12:09 AM, Ankita Kashyap
<ankita.kashyap....@gmail.com> wrote:
> stop(),destroy() etc. methods were deprecated by JDK versions, so must have
> not got support now. To stop thread, you should try to use flags, AFAIK.
>
>
> On Mon, Apr 30, 2012 at 9:34 AM, Matt Clark <mrclark32...@gmail.com> wrote:
>>
>> I am creating an app that sends various HTTP requests in seperate threads,
>> while doing so brings up a loading screen. If the network request is taking
>> longer then the user expects, I want them to be able to press the back
>> button to force quit the thread, and dismiss the loading screen.
>> I have my thread set up as:
>>
>> dataThread = new Thread(new Runnable() {
>> public void run() {
>> //...
>> //Networking Data and Handlers
>> //...
>> }
>> });
>> dataThread.start();
>>
>> and where I want to force quit at onBackPressed() I have tried:
>>
>> dataThread.stop();
>> dataThread.destroy();
>> dataThread.interrupt();
>>
>> And none of them work, Android does not support stop(), or destroy(), and
>> interrupt() does nothing to stop the thread. I do not care about exceptions
>> as everything will be caught, I just want it to allow the user to resume
>> doing what they want, if it hangs on requests, or even retry the request..
>>
>> Any and all help is greatly appreciated.
>> ~Matt
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to