Hi I\'m using following code to establish a url connection. But randomly I get the responseCode -1 (which is the default value of responseCode):
try {
UrlConnection is buggy.
See this blog post from the official Android Developer's blog for a pre-Gingerbread workaround for one problem.
My advice, don't use it. It was still being flaky for me on 3.2. I switched to HttpClient and things have been less bad.