can';不要在android应用程序中使用Http Post方法
嗨 我需要在android应用程序中为web服务使用http post方法。但在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
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
}