Android URL Encode encodeParams(ArrayList params)

Here you can find the source of encodeParams(ArrayList params)

Description

encode Params

Declaration

public static ArrayList<String> encodeParams(ArrayList<String> params)
            throws UnsupportedEncodingException 

Method Source Code

//package com.java2s;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

import java.util.ArrayList;

public class Main {
    public static ArrayList<String> encodeParams(ArrayList<String> params)
            throws UnsupportedEncodingException {
        ArrayList<String> encoded = new ArrayList<String>();
        for (String string : params) {
            String[] parts = string.split("=");
            if (parts.length == 2) {
                encoded.add(parts[0] + "="
                        + URLEncoder.encode(parts[1], "UTF-8"));
            } else {
                encoded.add(string);/*from   w w w .  jav  a2s. c o  m*/
            }
        }
        return encoded;

    }
}

Related

  1. urlEncode(String string)
  2. getURLEncodeStr(String url)
  3. getUrlCode(String pageUrl)
  4. urlEncode(String in)
  5. encode(String s)
  6. encodeUrl(Bundle parameters)
  7. encodeUriSegment(String segment)
  8. encodeUrl(Bundle parameters)
  9. encodeUrlParam(String s)