I am using a library called matrix.org
there are some javascript files in this library that contains some methods
is it possible to call these method inside native java or kotlin code of android studio ?
I am using a library called matrix.org
there are some javascript files in this library that contains some methods
is it possible to call these method inside native java or kotlin code of android studio ?
First you have to enable JavaScript
webView.getSettings().setJavaScriptEnabled(true);
To call JavaScript method you have to use evaluateJavascript(..)
method
webView.evaluateJavascript("javascript: " + "getValue(\"message\")", new ValueCallback<String>() {
@Override
public void onReceiveValue(String value) {
Log.i(TAG, "onReceive");
Log.i(TAG, "Received: " + value);
}
});
And your JavaScript method is like
function getValue(msg) {
return 10;
}