草庐IT

getHttpResponseCode

全部标签

android - getHttpResponseCode() 在 android 2.2 中返回 -1

在我的android应用程序中,我试图通过执行POST请求从服务器中提取数据。我正在使用HttpURLConnection类发出请求,因为android不再维护Apache的HttpClient。这就是我正在做的。privatebooleancallWS(){try{//Toavoidthebuginhttpurlconnectionpriorfroyowhich//causesthegetInputStreamtoreturnheadersalongwithresponseif(Build.VERSION.SDK_INT除了运行2.2的设备(没有在2.1上尝试过)之外,这在所有设备上