//Post請(qǐng)求數(shù)據(jù)
private void postInfo() { RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this); StringRequest stringRequest = new StringRequest(Request.Method.POST, mPostUrl, new Response.Listener() { @Override
public void onResponse(String response) {
mText.setText(response); } }, new Response.ErrorListener() {
@Override
public void onErrorResponse(
VolleyError error) { } }) { //因?yàn)槭荘OST請(qǐng)求吴菠,構(gòu)造方法里面沒(méi)有參數(shù) 他們給封裝到了構(gòu)造方法后邊
@Override
protected MapgetParams() throws AuthFailureError { Mapmap = new HashMap();
map.put("userName", "lxx");
map.put("passWord", "123");
return map;
}
};
requestQueue.add(stringRequest);
}