Java tutorial
//package com.java2s; import android.util.Pair; import java.util.List; public class Main { private static final String PARAMETER_SEPARATOR = "&"; private static final String NAME_VALUE_SEPARATOR = "="; public static String URLFormatQuery(List<Pair<String, String>> parameters) { if ((null != parameters) && (parameters.size() > 0)) { final StringBuilder result = new StringBuilder(); for (final Pair<String, String> parameter : parameters) { final String encodedName = parameter.first; final String value = parameter.second; final String encodedValue = (value != null ? value : ""); if (result.length() > 0) { result.append(PARAMETER_SEPARATOR); } result.append(encodedName); result.append(NAME_VALUE_SEPARATOR); result.append(encodedValue); } return result.toString(); } return null; } }