@Override
    protected void onPreExecute() {
      super.onPreExecute();

      dialog = new ProgressDialog(BookDetailsActivity.this);
      dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
      dialog.setCancelable(false);
      dialog.setCanceledOnTouchOutside(false);
      dialog.setMax(100);

      dialog.show();
    }
 @Override
 protected void onProgressUpdate(Integer... ints) {
   super.onProgressUpdate(ints);
   dialog.setProgress(ints[0]);
 }