protected String buildQuery(List<NameValuePair> valuePairs){
  StringBuilder stringBuilder=new StringBuilder();
  try {
    for (int i=0; i < valuePairs.size(); i++) {
      NameValuePair pair=valuePairs.get(i);
      stringBuilder.append(URLEncoder.encode(pair.getName(),"utf-8"));
      stringBuilder.append("=");
      stringBuilder.append(URLEncoder.encode(pair.getValue(),"utf-8"));
      if (i + 1 != valuePairs.size())       stringBuilder.append("&");
    }
  }
 catch (  UnsupportedEncodingException e) {
    e.printStackTrace();
  }
  return stringBuilder.toString();
}

protected String buildQuery ( List < NameValuePair > valuePairs ) { StringBuilder stringBuilder = new StringBuilder ( ) ; try { for ( int i = 0 ; i < valuePairs . size ( ) ; i ++ ) { NameValuePair pair = valuePairs . get ( i ) ; stringBuilder . append ( URLEncoder . encode ( pair . getName ( ) , "utf-8" ) ) ; stringBuilder . append ( "=" ) ; stringBuilder . append ( URLEncoder . encode ( pair . getValue ( ) , "utf-8" ) ) ; if ( i + 1 != valuePairs . size ( ) ) stringBuilder . append ( "&" ) ; } } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } return stringBuilder . toString ( ) ; }
build url encoded query
