开发者

Logcat printing "interface name: null" during each DefaultHttpClient execution method call

开发者 https://www.devze.com 2023-01-21 02:37 出处:网络
I am contacting a web service multiple times to get a JSON String via HttpGet and DefaultHttpClient. ...

I am contacting a web service multiple times to get a JSON String via HttpGet and DefaultHttpClient.

...
DefaultHttpClient defaultHttpClient = new DefaultHttpClient();
HttpGet httpGet = new HttpGet(url);
HttpResponse httpResponse = (HttpResponse)defaultHttpClient.execute(httpGet);
HttpEntity httpEntity = httpResponse.getEntity();
...

I find that LogCat is printing interface name: null with tag System.out for each time HttpResponse httpResponse = (HttpResponse)defaultHttpClient.execute(httpGet); is executed.

Am i establishing this http connection properl开发者_高级运维y with HttpGet? Is there a different way?

How can i create this connection and not get interface name: null LogCat messages from the System.out tag?


Are you using the DefaultHTTPClient Asynchronously? I had a similar error in the past (Android 2.x) and found once I made a singleton for the DefaultHTTPClient and put my web request inside an AsyncTask this error went away.


Use these;

HttpClient client = new DefaultHttpClient();
0

精彩评论

暂无评论...
验证码 换一张
取 消