我想通过android中的POST方法将一些数据发送到服务器。我正在使用下面的代码将数据发布到android中的服务器
DefaultHttpClient hc=new DefaultHttpClient();
ResponseHandler <String> res=new BasicResponseHandler();
HttpPost postMethod=new HttpPost(url);
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("name", "value"));
nameValuePairs.add(new BasicNameValuePair("password", "value"));
postMethod.setEntity(new UrlEncodedFormEntity(nameValuePairs));
String response=hc.execute(postMethod,res);
但我在我的响应XML获取错误响应。错误消息是Cookie在客户机中被禁用。我如何需要在android中启用cookie?
请将代码放在代码块中。 – xandy 2010-11-01 07:53:23