Amira Elsayed Ismail
Amira Elsayed Ismail

Reputation: 9394

show native loading in CordovaWebView before fully load javascript

I'm new using CordovaWebView and I have the following problem

When I try to load content into CordovaWebView, first it shows an empty white screen for sometime until it loads it's content.

What I want is to show native loading screen until the CordovaWebView finish loading it's content

Can anyone help here ?

Upvotes: 2

Views: 738

Answers (1)

Megha
Megha

Reputation: 631

You can override the cordovaWebviewClient present in cordova lib and implement "onPageStarted" and "onPageFinished" methods. In pagestart make progress bar visiblity to visible and on page finish make it to gone.

 public void onPageStarted(WebView view, String url, Bitmap favicon) {
      // TODO Auto-generated method stub
      super.onPageStarted(view, url, favicon);

            progressBar.setVisibility(View.GONE);
     }

     public void onPageFinished(WebView view, String url) {
  // TODO Auto-generated method stub
      super.onPageFinished(view, url);

      progressBar.setVisibility(View.GONE);
     }

Upvotes: 3

Related Questions