JLouis
JLouis

Reputation: 284

Identify the page to which it goes, within a webview

There is some method to identify in a webview, if the user clicks link 1 or link 2, and do something about it, for example within the webview if the user goes to page 2 show an image, or if you go to link 3 display this page and the application displays a text, in short, detect in which page the user is located within the webview and make an action about it, any ideas and/or examples of this type of activities? Really would appreciate your help.

Upvotes: 0

Views: 121

Answers (1)

Abhi
Abhi

Reputation: 9005

Get the link of the current page, so that you can perform the action

wbView.setWebViewClient(new MyWebViewClient());
       wbView.loadUrl("Url");

private class MyWebViewClient extends WebViewClient {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url)
        {
            Log.v("uuuurl",url);
            view.loadUrl(url);
            return true;
        }
    }  

Upvotes: 1

Related Questions