How to pass a function as a parameter in Javascript Interface, save it as a string and then call?
For example, I describe the Javascript Interface:
class JSInterface{
  String myFunction;
  //set function into myFunction attribute
  @JavascriptInterface
  public void setMyFunction(String func) {
    this.myFunction = func;
  }
  @JavascriptInterface
  public void executeMyFunction() {
    webView.loadUrl("javascript:"+this.myFunction);
  }
}
Add it:
//...
webview..addJavascriptInterface(new JSInterface, "application");
//...
In JS:
window.application.setMyFunction(function(){
        //some code here...
});
NOTE: Transfer function from JS need in this form, not as a string or json.
But in fact, in setMyFunction i get "undefined" but expect "window.application.setMyFunction(function(){ //some code here...});". Tell me please what to do, I will be very grateful!
 
     
    