Android Http Post buildNameValuePair( Hashtable httpPost)

Here you can find the source of buildNameValuePair( Hashtable httpPost)

Description

build Name Value Pair

Declaration

private static List<NameValuePair> buildNameValuePair(
            Hashtable<String, String> httpPost) 

Method Source Code

//package com.java2s;

import org.apache.http.NameValuePair;

import org.apache.http.message.BasicNameValuePair;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.List;

public class Main {
    private static List<NameValuePair> buildNameValuePair(
            Hashtable<String, String> httpPost) {
        if (httpPost == null)
            return null;
        List<NameValuePair> nvps = new ArrayList<NameValuePair>();
        Enumeration<String> keys = httpPost.keys();
        while (keys.hasMoreElements()) {
            String key = (String) keys.nextElement();
            String value = (String) httpPost.get(key);
            BasicNameValuePair nv = new BasicNameValuePair(key, value);
            nvps.add(nv);// ww w  .j a va 2 s  .co  m
        }
        return nvps;
    }
}

Related

  1. httpPost(String... params)
  2. writeData(HttpURLConnection conn, String boundary, File file, String mimeType, String fieldName)
  3. prepareAndSendHttpPost(String URI, ArrayList params)
  4. sendPostRequest(String path, String params, String encoding)
  5. executePost(String url, String parameters)