代码如下
RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
StringRequest sReq = new StringRequest(Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
s = response;
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError arg0) {
}
}){
@Override
protected Map<String, String> getParams()
throws AuthFailureError {
Map<String ,String> map = new HashMap<String, String>();
map.put("appKey", HttpConstant.APPKEY);//appKey
map.put("method", "pay.CreateOrder");//接口名
map.put("v","1.0");//接口版本号
long millis = System.currentTimeMillis();
String time = DateUtil.formatDateTime2(millis);
int i = (int)(1+Math.random()*999999);
Log.i("i", time+i);
map.put("bill_no",time+i);//订单号
map.put("total_fee", Integer.reverse(i)+"");//订单总金额
map.put("title", "订单1");//订单标题
map.put("channel","WX_APP");//支付渠道
map.put("app_id","app_id");//appid
return map;
}
};
queue.add(sReq);
其中map.put("total_fee", Integer.reverse(i));传的是Integer 但Integer没法传,怎么办
RequestQueue queue = Volley.newRequestQueue(getApplicationContext());
StringRequest sReq = new StringRequest(Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
s = response;
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError arg0) {
}
}){
@Override
protected Map<String, String> getParams()
throws AuthFailureError {
Map<String ,String> map = new HashMap<String, String>();
map.put("appKey", HttpConstant.APPKEY);//appKey
map.put("method", "pay.CreateOrder");//接口名
map.put("v","1.0");//接口版本号
long millis = System.currentTimeMillis();
String time = DateUtil.formatDateTime2(millis);
int i = (int)(1+Math.random()*999999);
Log.i("i", time+i);
map.put("bill_no",time+i);//订单号
map.put("total_fee", Integer.reverse(i)+"");//订单总金额
map.put("title", "订单1");//订单标题
map.put("channel","WX_APP");//支付渠道
map.put("app_id","app_id");//appid
return map;
}
};
queue.add(sReq);
其中map.put("total_fee", Integer.reverse(i));传的是Integer 但Integer没法传,怎么办