Let's talk about the usage of NameValuePair in Android. A list is
defined . The data type of the list is NameValuePair (simple name value pair node type). This code is used in many places in Java to send Post requests like url. Use this list to store parameters when sending post requests.
The general process of sending a request is as follows:
String url="http://www.baidu.com";
HttpPost httppost=new HttpPost(url); //Create HttpPost object
List<NameValuePair> params=new ArrayList<NameValuePair>();
//Create a NameValuePair array to store the parameters to be
sent params.add(new BasicNameValuePair("pwd","2544"));
//Add parameters
httppost.setEntity(new UrlEncodedFormEntity(params,HTTP.UTF_8));
//Set encoding
HttpResponse response=new DefaultHttpClient().execute(httppost);
//Send Post and return an HttpResponse object
Android: NameValuePair usage
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=326762878&siteId=291194637
Recommended
Ranking