Android传递中文参数方法(之一)
阅读原文时间:2023年07月14日阅读:1

最近在做app,用的volley传参,有一个地方传中文参数不行(貌似是get方式),我又试了下post方式,成功了,记录下,以后有用!

RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext());
StringRequest stringrequest=new StringRequest(Request.Method.POST, "http:/***", new Response.Listener() {
@Override
public void onResponse(String s) {
Toast.makeText(CommitApprasialActivity.this,"",Toast.LENGTH_SHORT).show();
RepairInfor rep=new RepairInfor();
rep.setRep_appraisal(edit_appraisal.getText().toString());
RepairListActivity.instance.finish();
Rep_ItemActivity.instance.finish();
startActivity(new Intent(CommitApprasialActivity.this,RepairListActivity.class));
finish();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
}
}){
protected Map getParams(){
Map map=new HashMap();
map.put("",);
map.put("",);
return map;
}
};
requestQueue.add(stringrequest);