什么是使用列表<的NameValuePair>或ArrayList的<的NameValuePair> [英] What is the use of List<NameValuePair> or ArrayList<NameValuePair>

查看:398
本文介绍了什么是使用列表<的NameValuePair>或ArrayList的<的NameValuePair>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道有什么用名单,其中的;的NameValuePair> 的ArrayList<的NameValuePair> 的机器人?特别是当我们使用的AsyncTask&LT使用Web服务; ...>

I want to know about What is the use of List<NameValuePair> or ArrayList<NameValuePair> in android? Specially when we are using web services using AsyncTask<...>

推荐答案

的NameValuePair是一个特殊的&LT;关键字,值&GT;这是用来重新present 对在HTTP请求中,即参数 www.xxx.com?key=value

NameValuePair is a special <Key, Value> pair which is used to represent parameters in http request, i.e. www.xxx.com?key=value.

的NameValuePair是一个接口,并在Apache的HTTP客户端,它被广泛应用在Java中处理HTTP操作的定义。 A 名单,其中,的NameValuePair&GT; 是只是一个List &LT;关键字,值&GT; 对,将被用作PARAMS在HTTP POST请求。

NameValuePair is an interface and is defined in apache http client, which is widely used in java to handle http operations. A List<NameValuePair> is just a list of <key, value> pairs, and will be used as params in http post request.

HttpPost request = new HttpPost();
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("key", "value"));
request.setEntity(new UrlEncodedFormEntity(params));

httpClient.execute(request);

这篇关于什么是使用列表&LT;的NameValuePair&GT;或ArrayList的&LT;的NameValuePair&GT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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