Androidhttpclient Can Not Getentity().getcontent() After Closed
public InputStream getInputStream() { AndroidHttpClient client = AndroidHttpClient.newInstance(USERAGENT); HttpUriRequest request = new HttpGet(url); InputStream in = n
Solution 1:
Like this, for instance:
public InputStream getInputStream() {
AndroidHttpClientclient= AndroidHttpClient.newInstance(USERAGENT);
HttpUriRequestrequest=newHttpGet(url);
InputStreamin=null;
try {
HttpResponseresponse= client.execute(request);
returnnewByteArrayInputStream(newEntityUtils.toByteArray(response.getEntity()));
} catch (IOException e) {
e.printStackTrace();
} finally {
client.close();
}
}
Post a Comment for "Androidhttpclient Can Not Getentity().getcontent() After Closed"