user1060362
user1060362

Reputation: 109

Event click link in WebView

I have a webview and webview has contain a URL..I want to click to URL ,an alert dialog notification will display. My idea is: when click that URL,the web browser default will load that URL to go to webpage..I will get URL in web browser and compares..If true,it will display alert dialog ,unless it not display. But I don't know get URL in web browser default.How must I do??

Upvotes: 0

Views: 640

Answers (1)

Darry Morales
Darry Morales

Reputation: 171

You can obtain the url loaded in a webview whit:

webview.getUrl();

also you can override onProgressChanged Method and take action when a page finishes loading

webview.setWebChromeClient(new WebChromeClient() {

@Override
public void onProgressChanged(WebView view, int progress){  

        if(progress == 100){
             // Takes the actions
        }
    }
});

Upvotes: 3

Related Questions