我正在开发一个应用程序,它将大量数据发送到server.Now我想使用volley发送一个params数组到php页面.但是我无法发送它.
将params添加为Array的代码.
String[] arr =new String[7];
for(int i=1;i<=7;i++)
{
arr[i]="questionId_"+i+"_"+"ans_"+i;
}
HashMap<String ,String[]> params=new HashMap<String, String[]>(7);
params.put("params", arr);
Run Code Online (Sandbox Code Playgroud)
向服务器发出请求的代码
RequestQueue que=Volley.newRequestQueue(this);
final ProgressDialog dialog = new ProgressDialog(HealthMyHistory.this);
dialog.setTitle("Please Wait");
dialog.setMessage("Sending Data");
dialog.setCancelable(false);
dialog.show();
CustomJobjectRequest jsObjRequest = new CustomJobjectRequest(Method.POST, url, params, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response)
{
dialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError response) {
dialog.dismiss();
Toast.makeText(getApplicationContext(), "Unable to Send Data!"+" "+response.toString(), Toast.LENGTH_SHORT).show();
}
});
que.add(jsObjRequest);
}
Problem is in CustomJobjectRequest there is no …Run Code Online (Sandbox Code Playgroud)