安卓怎么使用httpclient使用实例

如何在API23(Android6.0)中使用HttpClient - 简书
如何在API23(Android6.0)中使用HttpClient
现在这个时代科技发展飞快,代码更新的也很快,但是书籍等学习资料更新却没有那么快,导致有很多代码在以前是对的,现在使用却又各种各样的问题~~回归正题,回到关于HttpClient的使用上,在安卓开发中,如果使用现在最新的API23进行编译,你会惊喜的发现,如果使用HttpClient报错了!!怎么回事?直接复制代码也有错?原因是API23即在Android 6.0(API 23) 中,Google已经移除了Apache HttpClient 想关类,推荐使用HttpUrlConnection。但是如果你还想使用这个类怎么办?
1.eclipse:libs中加入org.apache.http.legacy.jar上面的jar包在:**\android-sdk-& & windows\platforms\android-23\optional下(需要下载android 6.0的SDK)
2.android studio:在相应的module下的build.gradle中加入:android {
useLibrary 'org.apache.http.legacy'}注意放置的位置:是在android {}中
原文地址:
进击的android开发者> 博客详情
摘要: android中经常使用的网络请求是超文本网络请求,http和https,http代表了大众的请求方式,https是ssl通信,https请求需要服务端和客户端反反复复的验证和加密
在android中,经常不可避免的的使用https和http访问网络数据,因此需要先构建一个网络访问client
其中https的访问需要使用SSLSocket,但对于一般安全性要求不是很高的通信,一般设置SSLSocket是允许所有主机通过,下面给出2中,一种是允许所有主机通过的https通信,另一种是加密传输,需要使用cert证书。
允许所有主机通过
public&class&GlobalUtils
&&&&&public&static&HttpClient&getAndroidHttpClient(int&connTimeout,&String&userAgent,int&retryTimes)
&&&&&&&&&&&&&&AbstractHttpClient&httpClient&=&
&&&&&&//设置请求控制参数
&&&&&&HttpParams&params&=&new&BasicHttpParams();
&&&&&&ConnManagerParams.setTimeout(params,&connTimeout);
&&&&&&HttpConnectionParams.setSoTimeout(params,&connTimeout);
&&&&&&HttpConnectionParams.setConnectionTimeout(params,&connTimeout);
&&&&&&&&if&(TextUtils.isEmpty(userAgent))&{
&&&&&&&&&&&&userAgent&=&System.getProperty("http.agents",&"Mozilla/5.0&(Windows&NT&6.1;&WOW64)&AppleWebKit/537.36&(KHTML,&like&Gecko)&Chrome/37.0.&Safari/537.36");
&&&&&&&&HttpProtocolParams.setUserAgent(params,&userAgent);
&&&&&&&&&&&&&&&//设置最大的连接数
&&&&&&&&ConnManagerParams.setMaxConnectionsPerRoute(params,&new&ConnPerRouteBean(10));
&&&&&&&&ConnManagerParams.setMaxTotalConnections(params,&10);
&&&&&&&&HttpConnectionParams.setTcpNoDelay(params,&true);&//关闭Socket缓冲
&&&&&&&&HttpConnectionParams.setSocketBufferSize(params,&1024&*&8);//本方法与setTcpNoDelay冲突
&&&&&&&&HttpProtocolParams.setVersion(params,&HttpVersion.HTTP_1_1);
&&&&&&&&SchemeRegistry&schemeRegistry&=&new&SchemeRegistry();
&&&&&&&&schemeRegistry.register(new&Scheme("http",&PlainSocketFactory.getSocketFactory(),&80));
&&&&&&&&schemeRegistry.register(new&Scheme("https",&DefaultSSLSocketFactory.getSocketFactory(),&443));
&&&&&&&&httpClient&=&new&DefaultHttpClient(new&ThreadSafeClientConnManager(params,&schemeRegistry),&params);
&&&&&&&&httpClient.setHttpRequestRetryHandler(new&RetryHandler(retryTimes));
&&&&&&&&httpClient.addRequestInterceptor(new&HttpRequestInterceptor()&{
&&&&&&&&&&&&@Override
&&&&&&&&&&&&public&void&process(org.apache.http.HttpRequest&httpRequest,&HttpContext&httpContext)&throws&org.apache.http.HttpException,&IOException&{
&&&&&&&&&&&&&&&&if&(!httpRequest.containsHeader("Accept-Encoding"))&{
&&&&&&&&&&&&&&&&&&&&httpRequest.addHeader("Accept-Encoding",&"gzip");
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&}
&&&&&&&&});
&&&&&&&&httpClient.addResponseInterceptor(new&HttpResponseInterceptor()&{
&&&&&&&&&&&&@Override
&&&&&&&&&&&&public&void&process(HttpResponse&response,&HttpContext&httpContext)&throws&org.apache.http.HttpException,&IOException&{
&&&&&&&&&&&&&&&&final&HttpEntity&entity&=&response.getEntity();
&&&&&&&&&&&&&&&&if&(entity&==&null)&{
&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&&&&&final&Header&encoding&=&entity.getContentEncoding();
&&&&&&&&&&&&&&&&if&(encoding&!=&null)&{
&&&&&&&&&&&&&&&&&&&&for&(HeaderElement&element&:&encoding.getElements())&{
&&&&&&&&&&&&&&&&&&&&&&&&if&(element.getName().equalsIgnoreCase("gzip"))&{
&&&&&&&&&&&&&&&&&&&&&&&&&&&&response.setEntity(new&GZipDecompressingEntity(response.getEntity()));
&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&&&&&&&&&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&}
&&&&&&&&});
return&httpC
上面的重试RetryHandler是请求失败后重试的规则
public&class&RetryHandler&implements&HttpRequestRetryHandler&{&&//需要实现HttpRequestRetryHandler
&&&&private&static&final&int&RETRY_SLEEP_INTERVAL&=&500;
&&&&private&static&HashSet&Class&?&&&exceptionWhiteList&=&new&HashSet&Class&?&&();
&&&&private&static&HashSet&Class&?&&&exceptionBlackList&=&new&HashSet&Class&?&&();
&&&&static&{
&&&&&&&&exceptionWhiteList.add(NoHttpResponseException.class);
&&&&&&&&exceptionWhiteList.add(UnknownHostException.class);
&&&&&&&&exceptionWhiteList.add(SocketException.class);
&&&&&&&&exceptionBlackList.add(InterruptedIOException.class);
&&&&&&&&exceptionBlackList.add(SSLHandshakeException.class);
&&&&private&final&int&maxR
&&&&public&RetryHandler(int&maxRetries)&{
&&&&&&&&this.maxRetries&=&maxR
&&&&@Override
&&&&public&boolean&retryRequest(IOException&exception,&int&retriedTimes,&HttpContext&context)&{
&&&&&&&&boolean&retry&=&
&&&&&&&&if&(exception&==&null&||&context&==&null)&{
&&&&&&&&&&&&return&
&&&&&&&&Object&isReqSent&=&context.getAttribute(ExecutionContext.HTTP_REQ_SENT);
&&&&&&&&boolean&sent&=&isReqSent&==&null&?&false&:&(Boolean)&isReqS
&&&&&&&&if&(retriedTimes&&&maxRetries)&{
&&&&&&&&&&&&retry&=&
&&&&&&&&}&else&if&(exceptionBlackList.contains(exception.getClass()))&{
&&&&&&&&&&&&retry&=&
&&&&&&&&}&else&if&(exceptionWhiteList.contains(exception.getClass()))&{
&&&&&&&&&&&&retry&=&
&&&&&&&&}&else&if&(!sent)&{
&&&&&&&&&&&&retry&=&
&&&&&&&&if&(retry)&{
&&&&&&&&&&&&try&{
&&&&&&&&&&&&&&&&Object&currRequest&=&context.getAttribute(ExecutionContext.HTTP_REQUEST);
&&&&&&&&&&&&&&&&if&(currRequest&!=&null)&{
&&&&&&&&&&&&&&&&//这里只允许GET请求的重试,因为在一般访问中POST重试会造成重复提交问题,因此不宜使用
&&&&&&&&&&&&&&&&&&&&if&(currRequest&instanceof&HttpRequestBase)&{
&&&&&&&&&&&&&&&&&&&&&&&&HttpRequestBase&requestBase&=&(HttpRequestBase)&currR
&&&&&&&&&&&&&&&&&&&&&&&&retry&=&"GET".equals(requestBase.getMethod());
&&&&&&&&&&&&&&&&&&&&}&else&if&(currRequest&instanceof&RequestWrapper)&{
&&&&&&&&&&&&&&&&&&&&&&&&RequestWrapper&requestWrapper&=&(RequestWrapper)&currR
&&&&&&&&&&&&&&&&&&&&&&&&retry&=&"GET".equals(requestWrapper.getMethod());
&&&&&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&&&&&}&else&{
&&&&&&&&&&&&&&&&&&&&retry&=&
&&&&&&&&&&&&&&&&&&&&LogUtils.e("retry&error,&curr&request&is&null");
&&&&&&&&&&&&&&&&}
&&&&&&&&&&&&}&catch&(Throwable&e)&{
&&&&&&&&&&&&&&&&retry&=&
&&&&&&&&&&&&&&&&LogUtils.e("retry&error",&e);
&&&&&&&&&&&&}
&&&&&&&&if&(retry)&{
&&&&&&&&&&&&SystemClock.sleep(RETRY_SLEEP_INTERVAL);&//&sleep&a&while&and&retry&http&request&again.
&&&&&&&&return&
需要重写SSLSocketFactory来支持所有主机通过
public&class&DefaultSSLSocketFactory&extends&SSLSocketFactory&{
&&&&//ssl上下文环境
&&&&private&SSLContext&sslContext&=&SSLContext.getInstance("TLS");
&&&&//证书保存对象
&&&&private&static&KeyStore&trustS
&&&&static&{
&&&&&&&&try&{
&&&&&&&&&&&&trustStore&=&KeyStore.getInstance(KeyStore.getDefaultType());
&&&&&&&&&&&&//通常这里需要加载证书
&&&&&&&&&&&&trustStore.load(null,&null);
&&&&&&&&}&catch&(Throwable&e)&{
&&&&&&&&&&&e.printStackTrace();
&&&&private&static&DefaultSSLSocketFactory&
&&&&public&static&DefaultSSLSocketFactory&getSocketFactory()&{
&&&&&&&&if&(instance&==&null)&{
&&&&&&&&&&&&try&{
&&&&&&&&&&&&&&&&instance&=&new&DefaultSSLSocketFactory();
&&&&&&&&&&&&}&catch&(Throwable&e)&{
&&&&&&&&&&&&&&&&LogUtils.e(e.getMessage(),&e);
&&&&&&&&&&&&}
&&&&&&&&return&
&&&&private&DefaultSSLSocketFactory()
&&&&&&&&&&&&throws&UnrecoverableKeyException,
&&&&&&&&&&&&NoSuchAlgorithmException,
&&&&&&&&&&&&KeyStoreException,
&&&&&&&&&&&&KeyManagementException&{
&&&&&&&&super(trustStore);
&&&&&&&&TrustManager&trustAllCerts&=&new&X509TrustManager()&{
&&&&&&&&&&&&public&java.security.cert.X509Certificate[]&getAcceptedIssuers()&{
&&&&&&&&&&&&&&&&return&
&&&&&&&&&&&&}
&&&&&&&&&&&&@Override
&&&&&&&&&&&&public&void&checkClientTrusted(
&&&&&&&&&&&&&&&&&&&&java.security.cert.X509Certificate[]&chain,&String&authType)
&&&&&&&&&&&&&&&&&&&&throws&java.security.cert.CertificateException&{
&&&&&&&&&&&&}
&&&&&&&&&&&&@Override
&&&&&&&&&&&&public&void&checkServerTrusted(
&&&&&&&&&&&&&&&&&&&&java.security.cert.X509Certificate[]&chain,&String&authType)
&&&&&&&&&&&&&&&&&&&&throws&java.security.cert.CertificateException&{
&&&&&&&&&&&&}
&&&&&&&&};
&&&&&&&&//初始化509凭证信任管理器
&&&&&&&&sslContext.init(null,&new&TrustManager[]{trustAllCerts},&null);
&&&&&&&&//设置所有请求都会得到客户端的信任
&&&&&&&&this.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
&&&&@Override
&&&&public&Socket&createSocket(Socket&socket,&String&host,&int&port,&boolean&autoClose)&throws&IOException&{
&&&&&&&&//连接SSL&Socket
&&&&&&&&return&sslContext.getSocketFactory().createSocket(socket,&host,&port,&autoClose);
&&&&@Override
&&&&public&Socket&createSocket()&throws&IOException&{
&&&&&&&&return&sslContext.getSocketFactory().createSocket();
当然上面的通信谈不上SSL加密,因此使用了https和没使用https请求没啥区别,就像http一样。
对于https安全请求的的加密过程,我们需要充分的认识,简单的说他是一个加密的过程。
对于这个过程的请求才叫安全请求,那么这个请求是怎么构建的呢
一般来说证书放在assets或者raw资源文件下(以下代码来自互联网,用户可以再第一段代码中稍作修改,便可使用)
public&void&getHttpsKeyStore(){
&&&&AssetManager&am&=&context.getAssets();&
&&&&InputStream&ins&=&am.open("robusoft.cer");&
&&&&&&&&&&&&//读取证书
&&&&&&&&&&&&CertificateFactory&cerFactory&=&CertificateFactory.getInstance("X.509");&&//问1
&&&&&&&&&&&&Certificate&cer&=&cerFactory.generateCertificate(ins);
&&&&&&&&&&&&//创建一个证书库,并将证书导入证书库
&&&&&&&&&&&&KeyStore&keyStore&=&KeyStore.getInstance("PKCS12",&"BC");&&&//问2
&&&&&&&&&&&&keyStore.load(null,&null);
&&&&&&&&&&&&keyStore.setCertificateEntry("trust",&cer);
&&&&&&&&&&&&return&keyS
&&&&}&finally&{
&&&&&&&&&&&&ins.close();
将这里代码整合到第一段代码中,形成https安全请求,当然也可以单独使用,
public&static&HttpClient&getAndroidHttpClient(int&connTimeout,&String&userAgent,int&retryTimes)
&&&AssetManager&am&=&context.getAssets();&
&&&&InputStream&ins&=&am.open("robusoft.cer");&
&&&&&&&&&&&&//读取证书
&&&&&&&&&&&&CertificateFactory&cerFactory&=&CertificateFactory.getInstance("X.509");&&//问1
&&&&&&&&&&&&Certificate&cer&=&cerFactory.generateCertificate(ins);
&&&&&&&&&&&&//创建一个证书库,并将证书导入证书库
&&&&&&&&&&&&KeyStore&keyStore&=&KeyStore.getInstance("PKCS12",&"BC");&&&//问2
&&&&&&&&&&&&keyStore.load(null,&null);
&&&&&&&&&&&&keyStore.setCertificateEntry("trust",&cer);
&&&&&&&&&&&&&//把咱的证书库作为信任证书库
&&&&&&&&&&&&SSLSocketFactory&socketFactory&=&new&SSLSocketFactory(keystore);
&&&&&&&&&&&&schemeRegistry.register(new&Scheme("https",&socketFactory&,&443));
&&&&}&finally&{
&&&&&&&&&&&&ins.close();
&&//&&......
人打赏支持
码字总数 299262
支付宝支付
微信扫码支付
打赏金额: ¥
已支付成功
打赏金额: ¥Android 如何用HttpClient 以Post方式提交数据并添加http头信息_Linux编程_Linux公社-Linux系统门户网站
你好,游客
Android 如何用HttpClient 以Post方式提交数据并添加http头信息
来源:Linux社区&
作者:love__coder
如何 post json格式的数据,并附加http头,接受返回数据,请看下面的代码:
private&void&HttpPostData()&{&&
&&&&HttpClient&httpclient&=&new&DefaultHttpClient();&&
&&&&String&uri&=&"";&&
&&&&HttpPost&httppost&=&new&HttpPost(uri);&&&
&&&&httppost.addHeader("Authorization",&"your&token");&&&
&&&&httppost.addHeader("Content-Type",&"application/json");&&
&&&&httppost.addHeader("User-Agent",&"imgfornote");&&
&&&&JSONObject&obj&=&new&JSONObject();&&
&&&&obj.put("name",&"your&name");&&
&&&&obj.put("parentId",&"your&parentid");&&
&&&&httppost.setEntity(new&StringEntity(obj.toString()));&&&&&
&&&&HttpResponse&&&
&&&&response&=&httpclient.execute(httppost);&&
&&&&int&code&=&response.getStatusLine().getStatusCode();&&
&&&&if&(code&==&<FONT color=#c)&{&&&
&&&&&&&&String&rev&=&EntityUtils.toString(response.getEntity());&&
&&&&&&&&obj&=&new&JSONObject(rev);&&
&&&&&&&&String&id&=&obj.getString("id");&&
&&&&&&&&String&version&=&obj.getString("version");&&
&&&&}&catch&(ClientProtocolException&e)&{&&&&&
&&&&}&catch&(IOException&e)&{&&&&&
&&&&}&catch&(Exception&e)&{&&&
主要用到的类有:org.apache.http.client.HttpClient 、org.apache.http.client.methods.HttpPost 和 org.json.JSONObject
相关资讯 & & &
& (03/08/:13)
& (07/10/:11)
& (11/28/:18)
& (10/10/:25)
& (11/01/:39)
   同意评论声明
   发表
尊重网上道德,遵守中华人民共和国的各项有关法律法规
承担一切因您的行为而直接或间接导致的民事或刑事法律责任
本站管理人员有权保留或删除其管辖留言中的任意内容
本站有权在网站内转载或引用您的评论
参与本评论即表明您已经阅读并???受上述条款更多频道内容在这里查看
爱奇艺用户将能永久保存播放记录
过滤短视频
暂无长视频(电视剧、纪录片、动漫、综艺、电影)播放记录,
使用您的微博帐号登录,即刻尊享微博用户专属服务。
使用您的QQ帐号登录,即刻尊享QQ用户专属服务。
使用您的人人帐号登录,即刻尊享人人用户专属服务。
按住视频可进行拖动
&正在加载...
请选择打赏金额:
把视频贴到Blog或BBS
当前浏览器仅支持手动复制代码
视频地址:
flash地址:
html代码:
通用代码:
通用代码可同时支持电脑和移动设备的分享播放
收藏成功,可进入
查看所有收藏列表
用爱奇艺APP或微信扫一扫,在手机上继续观看:
一键下载至手机
限爱奇艺安卓6.0以上版本
使用微信扫一扫,扫描左侧二维码,下载爱奇艺移动APP
其他安装方式:手机浏览器输入短链接http://71.am/udn
下载安装包到本机:
设备搜寻中...
请确保您要连接的设备(仅限安卓)登录了同一爱奇艺账号 且安装并开启不低于V6.0以上版本的爱奇艺客户端
连接失败!
请确保您要连接的设备(仅限安卓)登录了同一爱奇艺账号 且安装并开启不低于V6.0以上版本的爱奇艺客户端
部安卓(Android)设备,请点击进行选择
请您在手机端下载爱奇艺移动APP(仅支持安卓客户端)
使用微信扫一扫,下载爱奇艺移动APP
其他安装方式:手机浏览器输入短链接http://71.am/udn
下载安装包到本机:
爱奇艺云推送
请您在手机端登录爱奇艺移动APP(仅支持安卓客户端)
使用微信扫一扫,下载爱奇艺移动APP
180秒后更新
打开爱奇艺移动APP,点击“我的-扫一扫”,扫描左侧二维码进行登录
没有安装爱奇艺视频最新客户端?
爸爸去哪儿2游戏 立即参与
30秒后自动关闭
JavaEE Android教程 采用httpclient提交数据到服务器">JavaEE Android教程 采用httpclient提交数据到服务器
播放量数据:快去看看谁在和你一起看视频吧~
您使用浏览器不支持直接复制的功能,建议您使用Ctrl+C或右键全选进行地址复制
安装爱奇艺视频客户端,
马上开始为您下载本片
5秒后自动消失
&li data-elem="tabtitle" data-seq="{{seq}}"& &a href="javascript:void(0);"& &span>{{start}}-{{end}}&/span& &/a& &/li&
&li data-downloadSelect-elem="item" data-downloadSelect-selected="false" data-downloadSelect-tvid="{{tvid}}"& &a href="javascript:void(0);"&{{pd}}&/a&
选择您要下载的《
色情低俗内容
血腥暴力内容
广告或欺诈内容
侵犯了我的权力
还可以输入
您使用浏览器不支持直接复制的功能,建议您使用Ctrl+C或右键全选进行地址复制1.HttpClient是一个接口,因此无法创建它的实例,通常情况下都会创建一个DefaultHttpClient的实例
HttpClient httpClient=new DefaultHttpClient();
2.如果想要发起一条GET请求,就创建一个HttpGet对象,并传入目标网络的对象,然后调用HtttpClient中的excute()方法:
HttpGet httpGet=new HttpGet("");
HttpResponse httpResponse=httpClient.execute(httpGet);
如果想发起一条POST请求会比GET复杂一点,首先创建一个HttpPost对象,并传入目标网址
HttpPost httpPost=new HttpPost("http/:");
然后通过NameValuePair集合来存放待提交的数据,并将这个参数传入到一个UrlEncodedFormEntity中,然后调用HttpPost的setEntity()方法将构建好的UrlEncodedFormEntity传入
List&NameValuePair& params=new ArrayList&NameValuePair&();
params.add(new BasicNameValuePair("username","admin"));
params.add(new BasicNameValuepair("password","123456"));
UrlEncodeFormEntity entity=new UrlEncodeFormEntity(params,"utf-8");
httpPost.setEntity(entity);
接下来就和GET方法一样啦,httpClient.execute(httpPost);
3.执行完execute()方法后会返回一个HttpResponse对象,服务器返回的数据都在里面,通常我们会先取出服务器返回的状态码,如果等于200,则说明请求响应成功
if(httpResponse.getStatusLine().getStatueCode()==200){
  //请求和响应都成功了
4.读取服务器返回的具体内容,可以调用getEntity()访问获取到一个HttpEntity实例,然后调用EntityUtils.toString()这个静态类将HttpEntity转换成字符串
HttpEntity entity=httpResponse.getEntity();
String response=EntityUtils.toString(entity);
如果返回的数据带有中文,转换的时候需要将字符集指定为utf-8
String response=EntityUtils.toString(entity,"utf-8");
MainActivity
import android.os.H
import android.os.M
import android.support.v7.app.AppCompatA
import android.os.B
import android.view.V
import android.widget.B
import android.widget.TextV
import org.apache.http.HttpE
import org.apache.http.HttpR
import org.apache.http.client.HttpC
import org.apache.http.client.methods.HttpG
import org.apache.http.impl.client.DefaultHttpC
import org.apache.http.util.EntityU
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
public static final int SHOW_RESPONSE=0;//用于更新操作
private Button sendRequest_B
private TextView responseT
//用于处理和发送消息的Handler
private Handler handler=new Handler(){
public void handleMessage(Message msg){
switch (msg.what){
case SHOW_RESPONSE:
String response=(String)msg.
responseText.setText(response);
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sendRequest_Button=(Button)findViewById(R.id.sendrequest);
responseText=(TextView)findViewById(R.id.response_text);
sendRequest_Button.setOnClickListener(this);
public void onClick(View v) {
if(v.getId()==R.id.sendrequest){
sendRequestWithHttpClient();
public void sendRequestWithHttpClient(){
new Thread(new Runnable() {
public void run() {
HttpClient httpClient=new DefaultHttpClient();
HttpGet httpGet=new HttpGet("");
HttpResponse httpResponse=httpClient.execute(httpGet);
if(httpResponse.getStatusLine().getStatusCode()==200){
//请求和响应都成功了
HttpEntity entity=httpResponse.getEntity();
String response= EntityUtils.toString(entity, "utf-8");
Message message=new Message();
message.what=SHOW_RESPONSE;
//将服务器返回的结果保存到Message中
message.obj=response.toString();
handler.sendMessage(message);
}catch(Exception e){
}finally {
}).start();
AndroidManifest
&uses-permission android:name="android.permission.INTERNET"&&/uses-permission&
&?xml version="1.0" encoding="utf-8"?&
&LinearLayout xmlns:android="/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"&
android:id="@+id/sendrequest"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Send Request"/&
&ScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"&
android:id="@+id/response_text"
android:layout_width="match_parent"
android:layout_height="wrap_content" /&
&/ScrollView&
&/LinearLayout&
阅读(...) 评论()

我要回帖

更多关于 httpclient怎么使用 的文章

 

随机推荐