I need to pass some values to a URL by Post Method in my apllication. Please Help
A:
Here's some code that will make an HTTP POST request. Taken from http://androidadvice.blogspot.com/2010/10/httppost-request.html, which has some additional explanation as well.
HttpClient httpclient = new DefaultHttpClient(httpParameters);
HttpPost httppost = new HttpPost(Constants.MAIN_URL);
List<namevaluepair> nameValuePairs = new ArrayList<namevaluepair>(2);
nameValuePairs.add(new BasicNameValuePair("u", eUsername));
nameValuePairs.add(new BasicNameValuePair("p", ePassword));
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
Tom
2010-10-13 15:57:05