can't use Http Post method in android application
HI,
I need to use http post method for web-service in android application .But in android shows error w开发者_开发问答hen use this method .How to use this method in application or any other equal method for replacing this http post method.
thanks, Lakshmanan.
URL url = new URL(my_ip_address);
URLConnection connection = url.openConnection();
connection.setDoOutput(true);
connection.setDoInput(true);
connection.setRequestProperty("METHOD", "POST");
HttpURLConnection httpConnection = (HttpURLConnection)connection;
int responseCode = httpConnection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
//do your stuff
}
精彩评论