AndroidHttpClient对HttpURLConnection类的API 9级及以上 [英] AndroidHttpClient versus HttpUrlConnection for API Level 9 and above

查看:220
本文介绍了AndroidHttpClient对HttpURLConnection类的API 9级及以上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是API 9级(姜饼),为什么好?是否有利于使用AndroidHttpClient在HttpURLConnection的?

Which is better for API Level 9(Gingerbread) and why? Is there any benefit to use AndroidHttpClient over HttpUrlConnection?

任何帮助或指导将是非常美联社preciated。

Any help or guidance will be well appreciated.

推荐答案

谷歌没有按'牛逼推荐使用AndroidHttpClient ,只在很老的Andr​​oid版本。

Google doesn't recommend using AndroidHttpClient, only on very old Android versions.

不过,你可以在这么多问题看,的HttpURLConnection 不容易使用。这是非常低的水平,并且没有一个舒适的界面。你必须知道相当多的它是如何在内部工作,如果你有运气,你得到的异常,当您使用了错误的方式。

But as you can see in many questions on SO, HttpURLConnection is not easy to use. It's very low-level and doesn't have a comfortable interface. You have to know quite a lot how it's working internally and if you have luck, you get exceptions when you use it the wrong way.

由于这个原因,许多图书馆已经开发了Android开发者。你可以找到一个列表(和具体实施BTW)在​​ DavidWebb 。有这需要后台处理的负担,从您的低级库和一些非常强大的。

For that reason many libraries have been developed for Android developers. You can find a list (and a concrete implementation BTW) at DavidWebb. There are low-level libraries and some very powerful which take the burden of background processing from you.

修改

问:是否有任何好处,使用AndroidHttpClient

Q: Is there any benefit to use AndroidHttpClient?

答:从编程的观点来看, AndroidHttpClient 更容易使用。但随着谷歌表示,由于与向后兼容的困难,他们无法改善这个类,而是放在改善HUC一切努力(缩写为HttpURLConnection的)。对于我来说,这倒像是我们将让AndroidHttpClient死。当然,这个类将是present在Android SDK中,我想所有未来版本,但HUC确实引擎盖,例如在很多智能东西透明下载COM pression。

A: From programming point of view, AndroidHttpClient is much easier to use. But as Google says, due to difficulties with backward compatibility, they cannot improve this class and instead put all efforts in improving HUC (abbr. for HttpURLConnection). For me this reads like "we will let AndroidHttpClient die". Of course this class will be present in all future versions of Android SDK I suppose, but HUC does many intelligent things under the hood, e.g. transparent download compression.

TL;博士我不会用AndroidHttpClient当前应用程序开发

tl;dr I wouldn't use AndroidHttpClient for current app development.

这篇关于AndroidHttpClient对HttpURLConnection类的API 9级及以上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆