views:

26

answers:

0

I am using the following code

class CustomWebViewClient extends WebViewClient {
    Context context;
    ProgressDialog pd = null;


    public CustomWebViewClient (Context c){
        context = c;
    }

    public void onPageFinshed(WebView view, String url){
        pd.dismiss();
    }



    public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
        pd = ProgressDialog.show(context, "", "pageload. Please wait...", true);


        view.loadUrl(url);  

        return true;
    } 

}

When I click a link in the WebView, the dialog appears and the page begins to load, however when the page is finished loading, the dialog is still on the screen. Obviously the code is simple enough, but I cant figure this out. Also, I guess I should add that the links being clicked have a few redirects, but I am not sure if that is related to the cause here.

How can I do this right?

Thanks