码迷,mamicode.com
首页 > 其他好文 > 详细

Volley : "参数param:{ inoutNo:inoutNo ,whcode:’’}

时间:2016-06-06 18:34:51      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

private void fuzzySearch() {
mRequestQueue = Volley.newRequestQueue(getActivity());
String str = SharedPreUtil.getString(getActivity(), SharedPreUtil.KEY_URI);
IPPORT ip = JsonTools.parseJsonToBean(str, IPPORT.class);
String url = "http://" + ip.uriArray.get(0).ip + ":" + ip.uriArray.get(0).port + Url.OUTFUZZYSEARCH;
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("inoutNo", inOutNo.getText().toString().toLowerCase());
if (TextUtils.isEmpty(whCode.getText().toString())) {
jsonObject.put("whcode", "null");
}
} catch (JSONException e) {
e.printStackTrace();
}
LogUtil.e(TAG, inOutNo.getText().toString().toLowerCase());
LogUtil.e(TAG, jsonObject.toString());
mRequestQueue.cancelAll(TAG);
jsonRequest = new JsonObjectRequest(Request.Method.POST, url, jsonObject, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject jsonObject) {
LogUtil.e("!!!ok", jsonObject.toString());
//jsonObject.get("");
fuzzySearchData = JsonTools.parseJsonToBean(jsonObject.toString(), IOCOutMakeMaterialFuzzySearch.class);
if (fuzzySearchData.data == null) {
Log.e("msg", "msg zps");
} else {
for (int i = 0; i < fuzzySearchData.data.size(); i++) {
autoStrings.add(fuzzySearchData.data.get(i).pi_inoutno);
}
autoStringAdapter.notifyDataSetChanged();
}
loadingView.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
LogUtil.e("!!!err", new String(volleyError.networkResponse.data));
ErrorMsg errorMsg = JsonTools.parseJsonToBean(new String(volleyError.networkResponse.data), ErrorMsg.class);
Toast.makeText(getActivity().getApplicationContext(), errorMsg.exceptionInfo, Toast.LENGTH_LONG).show();
reset();
}
}) {
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return VolleyUtil.getVolleyUtil().setCookies();
}
};
jsonRequest.setTag(TAG);
mRequestQueue.add(jsonRequest);
}

Volley : "参数param:{ inoutNo:inoutNo ,whcode:’’}

标签:

原文地址:http://www.cnblogs.com/520-1314/p/5564572.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!