Android - Stop HTTP request
How can I stop the request to the server ? ...I want to disconnect from the server once the user press cancel button. I u开发者_C百科sed .diconnect() method but the application get force close
Yes, we've hit the same issue. There doesn't seem to be a "clean" way to cancel a connection, so we just wrap ours up in try { ... } catch
.
If you're playing in this area, you're also likely to discover that URLConnection
doesn't timeout correctly either. This is a good description of the problem:
http://thushw.blogspot.com/2010/10/java-urlconnection-provides-no-fail.html
精彩评论