I have to call a javascript method from my webview, passing parameters from native. And the result I have to get back in native. In api 19+ I'm using
mWebView.evaluateJavascript(JAVASCRIPT_NATIVE_REFERENCE_NAME, new ValueCallback<String>() {
@Override
public void onReceiveValue(String value) {
}
})
And its working fine. But evaluateJavascript
is not supported in API <=18 . Can someone please show a sample how it can be done in API 18 below. I already saw some SO answers
passing data to javascript in webview before android level 17 (4.2.2)
How to get return value from javascript in webview of android?
as shown in second question , can we call any method present in javascript like view.loadUrl("javascript:alert(functionThatReturnsSomething())");
??
Where we get the callback in this case. It would be helpful if someone could show a sample. Thanks in advance!!