标签:
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