I am trying to call the loadUrl method in a webview with the below url
http://stage.realtylog.net/iPhone/functions.php?username=xxx&ID=xxx&act=readFileAndPri
Yoy can use a List of NameValuePair and URLEncodedUtils to create the url string..
protected String addLocationToUrl(String url){
if(!url.endsWith("?"))
url += "?";
List params = new LinkedList();
if (lat != 0.0 && lon != 0.0){
params.add(new BasicNameValuePair("lat", String.valueOf(lat)));
params.add(new BasicNameValuePair("lon", String.valueOf(lon)));
}
if (address != null && address.getPostalCode() != null)
params.add(new BasicNameValuePair("postalCode", address.getPostalCode()));
if (address != null && address.getCountryCode() != null)
params.add(new BasicNameValuePair("country",address.getCountryCode()));
params.add(new BasicNameValuePair("user", agent.uniqueId));
String paramString = URLEncodedUtils.format(params, "utf-8");
url += paramString;
return url;
}
Alternate option is like following...you can try this also...
HttpPost postMethod = new HttpPost("your url");
List nameValuePairs = new ArrayList();
nameValuePairs.add(new BasicNameValuePair("your parameter","parameter value"));
nameValuePairs.add(new BasicNameValuePair("your parameter","parameter value"));
postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs));
DefaultHttpClient hc = new DefaultHttpClient();
HttpResponse response = hc.execute(postMethod);