0
我试图在android.c中实现分页。我现在有一个返回jsonarray的服务。Android如何使用参数调用Web服务并获取jsonarray作为响应
protected JSONArray doInBackground(String... params) {
JSONArray jsonArray = null;
String result = ServerConnect.readService("http://myservice.com/resbook_redberry/mobile/GetKitchenOrder");
try {
jsonArray = new JSONArray(result);
} catch (Exception e) {
e.printStackTrace();
try {
jsonArray = new JSONArray(result.substring(3));
} catch (JSONException e1) {
e1.printStackTrace();
} catch (Exception e2) {
e2.printStackTrace();
}
}
return jsonArray;
}
,但现在我需要发送的页码到Web服务,并得到JSONArray
作为响应。
我需要写HTTP后?为了做到这一点,我应该改变什么?
感谢您的answer..but我需要的是发布页号到服务器,并获得JSON数组根据该请求。在获取json之前,您是否将任何值发布到服务器? – san88 2014-09-23 08:23:05
是的,urlString =“http://www.xxxxx.com?page=1”你可以在url中加入查询字符串 – 2014-09-23 08:26:36
yes..但不幸的是它不接受通过url的参数。有没有选择发送参数给服务器以外的url? – san88 2014-09-23 08:37:17