安卓开发使用post传值为啥接收不到返回值,返回值那条语句根本就打印,url不方便透露,是正确的
安卓开发使用post传值为什么接收不到返回值,返回值那条语句根本就打印,url不方便透露,是正确的
------解决方案--------------------
httpResponse.getStatusLine().getStatusCode() 查看下状态码
------解决方案--------------------
网络没连上,服务器没返回,查看服务器端是否有收到你post的数据并做回复
private void postValues (JSONObject param) throws ClientProtocolException, IOException{
String url = "";
System.out.println(url);
HttpPost request = new HttpPost(url);
// 绑定到请求 Entry
StringEntity se;
se = new StringEntity(param.toString());
System.out.println("StringEntity长度------->"+se.getContentLength());
request.setEntity(se);
// 发送请求
HttpResponse httpResponse = new DefaultHttpClient().execute(request);
// 得到应答的字符串,这也是一个 JSON 格式保存的数据
String retSrc = EntityUtils.toString(httpResponse.getEntity());
System.out.println("返回值信息------------->"+retSrc);
------解决方案--------------------
httpResponse.getStatusLine().getStatusCode() 查看下状态码
------解决方案--------------------
网络没连上,服务器没返回,查看服务器端是否有收到你post的数据并做回复