O Volley ProgressDialog travou / congelou na hora de obter uma enorme quantidade de dados

Aqui está o meu código:

private void downloadSupplyTownData(final int townId2) {

    /*******************
     * Using Volley
     *******************/
    // Post params to be sent to the server
    HashMap<String, Object> params = new HashMap<String, Object>();
    params.put("ID",townId2);
   CustomDialogClass.showProgressDialog(context,true); 


    JsonObjectRequest req = new JsonObjectRequest(Consts.baseUrl+Consts.townSupplyUrl, new JSONObject(params),
           new Response.Listener<JSONObject>() {
               @Override
               public void onResponse(JSONObject response) {
                   try {
                       totalConsumerRecords =   Integer.parseInt(response.getString("TotalConsumerRecords").trim());
                       if(totalConsumerRecords>0)
                       {                               
                           /**For -----**/
                           JSONArray dtrArray   =   response.getJSONArray("xxx");
                           for(int i=0;i<dtrArray.length();i++)
                           {
                               JSONObject   dtrObj  =   dtrArray.getJSONObject(i);
                               supplyId1        =   Integer.parseInt(dtrObj.getString("SI"));
                               dtrId            =   Integer.parseInt(dtrObj.getString("DI"));
                               dtrImgUrl        =   dtrObj.getString("DIMG");
                               dtrCode          =   dtrObj.getString("DC");
                               assetPCode       =   dtrObj.getString("APC");
                               meterSN          =   dtrObj.getString("MSN");
                               System.out.println(dtrId);
                               db.addDtrInfo(new DTRBeanClass(dtrId,supplyId1,dtrCode,dtrImgUrl,assetPCode,meterSN));
                           }

                           /**For ----**/
                           JSONArray poleArray  =   response.getJSONArray("Pole");
                           for(int i=0;i<poleArray.length();i++)
                           {
                               JSONObject   poleObj =   poleArray.getJSONObject(i);
                               poleId           =   Integer.parseInt(poleObj.getString("PI"));
                               dtrId1           =   Integer.parseInt(poleObj.getString("DI"));
                               consumerCount    =   Integer.parseInt(poleObj.getString("ACA"));
                               poleImgUrl       =   poleObj.getString("PIMG");
                               poleCode         =   poleObj.getString("PC");
                               surveyerRemarks  =   poleObj.getString("RMS");
                               System.out.println(poleId);
                               db.addPoleInfo(new PoleBeanClass(poleId,dtrId1,poleCode,poleImgUrl,consumerCount,surveyerRemarks));
                           }

                           /**For ----**/
                           JSONArray consumerArray  =   response.getJSONArray("Supply");
                           for(int i=0;i<consumerArray.length();i++)
                           {
                               JSONObject   supplyObj   =   consumerArray.getJSONObject(i);
                               supplyId     =   Integer.parseInt(supplyObj.getString("SI"));
                               supplyTownId =   Integer.parseInt(supplyObj.getString("TI"));
                               supplyName   =   supplyObj.getString("SN");
                               System.out.println(supplyId);
                               db.addSupplierInfo(new SupplierChainBeanClass(supplyId,supplyTownId,supplyName));
                           }

                           CustomDialogClass.showProgressDialog(context,false);
                       }
                       else
                       {
                           CustomDialogClass.showProgressDialog(context,false);
                       }

                    } catch (JSONException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                    }                                                          
               }
           }, new Response.ErrorListener() {
               @Override
               public void onErrorResponse(VolleyError error) {
                   NetworkResponse networkResponse = error.networkResponse;
                   VolleyLog.e("Error: ", error.getMessage());
                   Log.d("Eroor", ""+networkResponse);
                   CustomDialogClass.showProgressDialog(context,false);
               }
           });

    // add the request object to the queue to be executed
    NameApplication.getInstance().addToRequestQueue(req);
}

Aqui, mostre e oculte o ProgressDialog porCustomDialogClass.showProgressDialog(context,true);

A caixa de diálogo Progresso gira primeiro de 2 a 3 segundos e depois fica presa. Por favor me ajude a lidar com isso.

EDITAR

/ ** * Mostrando caixa de diálogo * * / @Override caixa de diálogo protegida onCreateDialog (int id) {switch (id) {case progress_bar_type: // configuramos para 0 pDialog = new ProgressDialog (this); pDialog.setMessage ("Fazendo o download do arquivo. Aguarde ..."); pDialog.setIndeterminate (false); pDialog.setMax (100); pDialog.setProgressStyle (ProgressDialog.STYLE_HORIZONTAL); pDialog.setCancelable (true); pDialog.show (); retornar pDialog; padrão: retornar nulo; }}

/**
 * Background Async Task to download file
 * */
class DownloadFileFromURL extends AsyncTask<String, String, String> {

    /**
     * Before starting background thread
     * Show Progress Bar Dialog
     * */
    @Override
    protected void onPreExecute() {
        super.onPreExecute();
        showDialog(progress_bar_type);
    }

    /**
     * Downloading file in background thread
     * */
    @Override
    protected String doInBackground(String... f_url) {
        downloadSupplyTownData(townId);

        return null;
    }

    /**
     * Updating progress bar
     * */
    protected void onProgressUpdate(String... progress) {
        // setting progress percentage
        pDialog.setProgress(Integer.parseInt(progress[0]));
   }

    /**
     * After completing background task
     * Dismiss the progress dialog
     * **/
    @Override
    protected void onPostExecute(String file_url) {            
        dismissDialog(progress_bar_type);

    }

}

E, de vista, chame o AsynchTasknew DownloadFileFromURL().execute();

questionAnswers(1)

yourAnswerToTheQuestion