RequestQueue queue= Volley.newRequestQueue(getContext());
StringRequest sr=new StringRequest(InterFaceUrlSet.realUrl, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
JsonParser parser=new JsonParser();
JsonArray jsonArray=parser.parse(response).getAsJsonArray();
Gson gson=new Gson();
ArrayList<RealInfo> list=new ArrayList<>();
for (JsonElement jslist:jsonArray){
RealInfo realInfo=gson.fromJson(jslist,RealInfo.class);
list.add(realInfo);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
queue.add(sr);
以上为解决代码,里边的list已为解析成功的数组;
此为网络转载,原网页忘记了= =