title: Show progress bar while loading pdf file
body: <p>iam fairly new to android development, so what iam trying to make is app that can show pdf from url, </p>
  
  <p>I want to show progress bar while pdf file is loading from web(some pdf files are big over 15mb) How can i do that? </p>
  
  <p>iam using <code>com.github.barteksc.pdfviewer.PDFView</code> to show pdf from web</p>
  
  <p>here is my pdf show activity </p>
  
  <pre><code>private PDFView mPDFview;
  
  private String mStoreId;
  
  private FirebaseDatabase mFirebaseDatabase;
  private DatabaseReference mReference;
  
  
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_flyer);
  
  
      mFirebaseDatabase = FirebaseDatabase.getInstance();
      mReference = mFirebaseDatabase.getReference("Store");
  
      if (getIntent()!=null)
      {
          mStoreId = getIntent().getStringExtra("StoreId");
      }
  
      if (!mStoreId.isEmpty())
      {
          getUrlStoreFlyer(mStoreId);
      }
  
  }
  
  private void getUrlStoreFlyer(String storeId) {
      mReference.child(storeId).addValueEventListener(new ValueEventListener() 
  {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot) {
              Store storeChain = dataSnapshot.getValue(Store.class);
              String pdfUrl = storeChain.getFlyerPDF().toString();
              mPDFview = findViewById(R.id.flyer_pdfView);
              new RetrievePDFStream().execute(pdfUrl);
          }
  
          @Override
          public void onCancelled(DatabaseError databaseError) {
          }
      });
  }
  
  class RetrievePDFStream extends AsyncTask&lt;String, Void, InputStream&gt;
  {
      @Override
      protected InputStream doInBackground(String... strings)
      {
          InputStream inputStream = null;
          try{
              URL url = new URL(strings[0]);
              HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection();
  
              if (urlConnection.getResponseCode()==200)
              {
                  inputStream = new BufferedInputStream(urlConnection.getInputStream());
              }
          }
          catch (IOException e)
          {
              return null;
          }
  
          return inputStream;
      }
  
      @Override
      protected void onPostExecute(InputStream inputStream) {
          mPDFview.fromStream(inputStream).load();
      }
  }
  
  @Override
  public void onBackPressed() {
      finish();
      overridePendingTransition(0, 0);
  }
  }
  </code></pre>
  
  <p>Here is my xml </p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.test.FlyerActivity"&gt;
  
  
      &lt;ProgressBar
  
          android:layout_width="50dp"
          android:layout_height="50dp"
          android:layout_alignParentBottom="true"
          android:layout_centerHorizontal="true"
          android:layout_marginBottom="150dp"
          android:id="@+id/progressBar2" /&gt;
  
  
  
      &lt;com.github.barteksc.pdfviewer.PDFView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:id="@+id/flyer_pdfView"/&gt;
      enter code here
  
  &lt;/RelativeLayout&gt;
  </code></pre>