Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
can';不要在android应用程序中使用Http Post方法_Android - Fatal编程技术网

can';不要在android应用程序中使用Http Post方法

can';不要在android应用程序中使用Http Post方法,android,Android,嗨 我需要在android应用程序中为web服务使用http post方法。但在android中,使用此方法时会显示错误。如何在应用程序中使用此方法或任何其他等效方法来替换此http post方法 谢谢, 拉克希曼南 URL url = new URL(my_ip_address); URLConnection connection = url.openConnection(); connection.setDoOutput(true); connection.setDoI

我需要在android应用程序中为web服务使用http post方法。但在android中,使用此方法时会显示错误。如何在应用程序中使用此方法或任何其他等效方法来替换此http post方法

谢谢, 拉克希曼南

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
}