I have been trying to get a value from a class from the web page loaded in Webview
I've been searching for answers however I have tried many codes but it just didn't work at all
All I want to do is
I know that I have to use Java interface I have tried the following code but it just do not work
Inside WebViewClient
public void onPageFinished(WebView view, String url) {
wv.loadUrl("javascript: alert(function(){setTimeout(function(){var recieved_poin = document.querySelector(\".point\").innerHTML" +
"console.log(recieved_poin);}, 500);})();"); // input Id and password
}
Inside WebChromeClient
@Override
public boolean onJsAlert(WebView view, String url, String message, JsResult result) {
Log.d("LogTag", message);
Toast.makeText(getActivity(), "value recieved from class is "+message, Toast.LENGTH_SHORT).show();
result.confirm();
return true;
}
I am using getActivity() in toast because I'm inside a fragment
please help me out