I have seen this article:- Passing data from java class to Web View html
Can we return string from an android function to the html file in the webview of the android application.
I have seen this article:- Passing data from java class to Web View html
Can we return string from an android function to the html file in the webview of the android application.
You can implement some Java class returning such string:
public class Bar {
public String foo() {
return "bla-bla-bla";
}
}
After that you pass it to addJavascriptInterface method:
webView.addJavascriptInterface(new Bar(), "bar");
Now you have JavaScript object "bar":
alert(bar.foo());