There is a contentFinal page that is loaded into the WebView through Jsoup filters. The downloaded page has links to other pages on the site.

  WebView cntContent; WebView cntComments; WebSettings webSettingsContent; WebSettings webSettingsComments; cntContent = findViewById(R.id.cntContent); cntComments = findViewById(R.id.cntComments); webSettingsContent = cntContent.getSettings(); webSettingsComments = cntComments.getSettings(); webSettingsContent.setDefaultFontSize(16); webSettingsComments.setDefaultFontSize(16); cntContent.setBackgroundColor(Color.TRANSPARENT); cntComments.setBackgroundColor(Color.TRANSPARENT); webSettingsContent.setAppCacheEnabled(true); webSettingsComments.setAppCacheEnabled(true); cntContent.loadDataWithBaseURL(contentUrl, contentFinal, "text/html", "utf-8", null); cntComments.loadDataWithBaseURL(contentUrl, commentsFinal, "text/html", "utf-8", null); cntContent.setClickable(true); 

How to get url links when a user clicks on it? And how to track exactly click on the link? Those. I need to track the user's click on the link and put it in, for example, String userUrl . Next, I'll reassign the action.

    1 answer 1

    Helped on the English-language resource.

     WebView wv = new WebView(); wv.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, WebResourceRequest request) { String url = request.getUrl().toString(); return false; } });