Kotlin use Java callback interface

Viewed 10458

I have a WebView. I want to call

public void evaluateJavascript(String script, ValueCallback<String> resultCallback)

this method.

Here is the ValueCallback interface:

public interface ValueCallback<T> {
    /**
     * Invoked when the value is available.
     * @param value The value.
     */
    public void onReceiveValue(T value);
};

Here is my kotlin code:

webView.evaluateJavascript("a", ValueCallback<String> {
            // cant override function
        })

Anyone have idea to override the onReceiveValue method in kotlin? I tried the "Convert Java to Kotlin" but result is the next:

v.evaluateJavascript("e") {  }

Thanks!

2 Answers
Related