private void init() { String url = AppConfig.URL_SHOP + "product/getProdPicDetail"; JSONObject params = new JSONObject(); try { params.put("prodUuid", prodUuid); } catch (Exception e) { // TODO: handle exception } StringRequest stringRequest = new StringRequest( Method.POST, url, params, new Listener<String>() { @Override public void onResponse(String response) { // TODO Auto-generated method stub try { JSONArray jsonArray = new JSONArray(response); imageViews = new ArrayList<String>(); for (int i = 0; i < jsonArray.length(); i++) { imageViews.add(jsonArray.getJSONObject(i).getString("picUrl")); } gv_goods_pic_details.setAdapter( new GoodsDetailsAdapter(getActivity(), imageViews)); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }, new ErrorListener() { @Override public void onErrorResponse(VolleyError error) { // TODO Auto-generated method stub } }); stringRequest.setTag("getPicDetails"); MyApplication.getRequestQueue().add(stringRequest); }
@Override public void onDestroy() { // TODO Auto-generated method stub super.onDestroy(); MyApplication.getRequestQueue().cancelAll("getPicDetails"); }