title: Webview from firestore getting failed
body: <p>I made an webview activity. For this, url data is being received from firestore. Some time it works fine, onclick it will show progress bar,then view the file correctly.  But sometimes, onclick it doesn't show anything, but a white blank screen(means not even loading or showing progressbar). When i go back and try again and again, it will work fine after 3 or 4 attempts. what could be the reason?</p>
  <p>please support.</p>
  <p>Adapter class</p>
  <pre><code>private List&lt;Accountsmodel&gt; list;
          Accounts_Activity accounts_activity;
          private ItemClickListener itemClickListener;
  
          public AccountsAdapter(List&lt;Accountsmodel&gt; list, Accounts_Activity accounts_activity, ItemClickListener itemClickListener) {
              this.list=list;
              this.accounts_activity=accounts_activity;
              this.itemClickListener=itemClickListener;
          }
  
  
  
          @NonNull
          @Override
          public Accountsviewholder onCreateViewHolder(@NonNull ViewGroup parent, int i) {
              LayoutInflater layoutInflater = LayoutInflater.from(accounts_activity);
              View view = layoutInflater.inflate(R.layout.acc_pdf_item,parent,false);
              return new Accountsviewholder(view);
          }
  
          @Override
          public void onBindViewHolder(@NonNull final Accountsviewholder accountsviewholder, final int position) {
              accountsviewholder.aName.setText(list.get(position).getName());
              accountsviewholder.aUploaddate.setText(list.get(position).getUploaddate());
  
              accountsviewholder.acccardclk.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View view) {
                      itemClickListener.onClick(view,position,false);
                  }
              });
          }
  
          @Override
          public int getItemCount() {
              return list.size();
  
          }
  
          public class Accountsviewholder extends RecyclerView.ViewHolder  {
              private TextView aName;
              private TextView aUploaddate;
              private ImageButton accvbutton;
              private CardView acccardclk;
  
              public Accountsviewholder(View itemView) {
                  super(itemView);
                  aName = itemView.findViewById(R.id.accfilename);
                  aUploaddate = itemView.findViewById(R.id.adate);
                  acccardclk=itemView.findViewById(R.id.accRecyclk);
  
              }
  
  
          }
  
      }
  </code></pre>
  <p>Webview Class</p>
  <pre><code>public class PDFActivity extends AppCompatActivity {
  
      WebView webView;
      private ProgressBar progressBar;
      private String downloadlink;
  
  
  
      @SuppressLint(&quot;SetJavaScriptEnabled&quot;)
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_p_d_f);
  
          webView = findViewById(R.id.aWV);
          progressBar = findViewById(R.id.apb);
          progressBar.setVisibility(View.VISIBLE);
  
  
          webView.getSettings().setJavaScriptEnabled(true);
          webView.getSettings().setBuiltInZoomControls(true);
          webView.getSettings().setDisplayZoomControls(false);
          webView.setWebViewClient(new WebViewClient());
          Intent intent = getIntent();
          final int position = intent.getIntExtra(&quot;position&quot;, 0);
          downloadlink= (Accounts_Activity.list.get(position).getLink());
          webView.setWebViewClient(new WebViewClient() {
  
              @Override
              public void onPageFinished(WebView view, String url) {
                  webView.loadUrl(&quot;javascript:(function() { &quot; +
                          &quot;document.querySelector('[role=\&quot;toolbar\&quot;]').remove();})()&quot;);
                  progressBar.setVisibility(View.GONE);
              }
          });
  
          String url=&quot;&quot;;
          try {
              url = URLEncoder.encode(downloadlink,&quot;UTF-8&quot;);
          } catch (UnsupportedEncodingException e) {
              e.printStackTrace();
          }
          webView.loadUrl(&quot;http://drive.google.com/viewerng/viewer?embedded=true&amp;url=&quot; +url);
  
          }
  }
  </code></pre>