Android URL Encode encodeUrl(Bundle parameters)

Here you can find the source of encodeUrl(Bundle parameters)

Description

encode Url

Declaration

public static String encodeUrl(Bundle parameters) 

Method Source Code

//package com.java2s;

import java.net.URLEncoder;

import android.os.Bundle;

public class Main {

    public static String encodeUrl(Bundle parameters) {
        if (parameters == null) {
            return "";
        }//from  www  .  ja  v  a2 s.c om
        StringBuilder sb = new StringBuilder();
        boolean first = true;
        for (String key : parameters.keySet()) {
            if (first) {
                first = false;
            } else {
                sb.append("&");
            }
            sb.append(key + "="
                    + URLEncoder.encode(parameters.getString(key)));
            //sb.append(key + "=" + parameters.getString(key));
        }
        return sb.toString();
    }
}

Related

  1. urlEncode(String in)
  2. encode(String s)
  3. encodeParams(ArrayList params)
  4. encodeUrl(Bundle parameters)
  5. encodeUriSegment(String segment)
  6. encodeUrlParam(String s)
  7. weakUrlEncode(String url)
  8. encode(String s)
  9. getParams(Map params, String encode)