Search...

Thursday, December 1, 2011

How to send post HttpClient request in android


                List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();

                nameValuePairs.add(new BasicNameValuePair("country","us"));
                nameValuePairs.add(new BasicNameValuePair("city","nyc"));

                HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost("your_url");
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);

No comments:

Post a Comment