Android: Invalid use of SingleClientConnManager: connection still allocated [duplicate]

这一生的挚爱 提交于 2019-11-30 19:19:57

After calling:

HttpResponse rp = HttpSigleton.getInstance().execute(get);

Please make sure you make a call to either:

String html = EntityUtils.toString(rp.getEntity() /*, Encoding */);

or

EntityUtils.consume(rp.getEntity());

For Android:

If you are not interested in the content, the cheapest way to get rid of your connection and avoid the error "connection still allocated" is:

httpResponse.getEntity().consumeContent();

See http://developer.android.com/reference/org/apache/http/HttpEntity.html#consumeContent()

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!