Android How do I get the "Click String" string in an Android web browser?

How can I get String from webview when its click event

here is the image:

enter image description here

here i just want to get the blue colored strings programmatically and not the others.

I am using an HTML string. Display it as

 webview.setWebViewClient(new WebViewClient()); webview.getSettings().setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN); webview.loadDataWithBaseURL("file:///android_asset/", main_data , "text/html", "UTF-8", " "); 

Edit: How can I do this? Does anyone have an idea?

+4
source share
1 answer

I do not find anything to get the text directly. Workaround may be:

When you download webview, you parse the html. As described here

There you save all the links on the map using the URL as a key and text as a value.

Then:

 webview.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { String text = map.get(url); return super.shouldOverrideUrlLoading(view, url); } }); 
0
source

Source: https://habr.com/ru/post/1468931/


All Articles