wish help you to fix your issue Generally speaking, you don't do that. If you want the HTTP request to stop after hanging for a while, then set a timeout on it. It's always best to let the thread finish whatever work it's been given to do. Edit: Based on your source code, the first thing you need to do is make sure to call connect() on the URLConnection. Otherwise, nothing will happen. Take a look at Working with URLs in the Java Tutorial. After that, if you still want to set timeouts, use setConnectTimeout() to set the amount of time it should try to connect before timing out and setReadTimeout() to set the amount of time it should wait to receive data after a request is sent.
create thread from other thread throw exception like Can't create handler inside thread that has not called Looper.prepa
I wish this helpful for you You are doing many things in other thread, then should be event thread, like toast displaying, dismissing dialog, please place your code which need to be in Event thread, in event thread by using either Handler, or Asynctask.
Thread inside thread: what happens if parent thread is killed?