Adding a Progress Dialog in a webview

Check this code,

    final ProgressDialog pd = ProgressDialog.show(OnlinePaymentActivity.this, "", "Please wait, your transaction is being processed...", true);
            
    WebView mWebview  = (WebView)findViewById(R.id.webView1);
    mWebview.getSettings().setJavaScriptEnabled(true); // enable javascript
    mWebview.getSettings().setLoadWithOverviewMode(true);
    mWebview.getSettings().setUseWideViewPort(true);
    mWebview.getSettings().setBuiltInZoomControls(true);

    mWebview.setWebViewClient(new WebViewClient() {

        @Override
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            Toast.makeText(activity, description, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            pd.show();
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            pd.dismiss();
            String webUrl = mWebview.getUrl();
        }

    });

    mWebview .loadUrl("www.google.com");

Webview with progress dialog working for me. full working code

import android.app.ProgressDialog;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

import com.yubrajpoudel.R;

/**
 * Created by yubraj on 12/25/15.
 */
public class NewsActivity extends AppCompatActivity {
    private WebView webView;
    ProgressDialog prDialog;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.page_news);
        setSupportActionBar((Toolbar) findViewById(R.id.toolbar));

        webView = (WebView) findViewById(R.id.wv_news);
        webView.setWebViewClient(new MyWebViewClient());

        String url = "http://google.com/";
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);
        webView.loadUrl(url);


    }

    private class MyWebViewClient extends WebViewClient {

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            prDialog = new ProgressDialog(NewsActivity.this);
            prDialog.setMessage("Please wait ...");
            prDialog.show();
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            if(prDialog!=null){
                prDialog.dismiss();
            }
        }
    }
}