1

I am trying to get some values from my webview with javascript and use them later in my application:

webview.evaluateJavascript("(function() { return (getsSomeValue()); })();", new ValueCallback<String>() {
    @Override
    public void onReceiveValue(String valueFromJS) {

        //I can use valueFromJS here                         
        System.out.println(valueFromJS); // prints the value
    }
});

// but I need to use valueFromJS here...

Please help me to take that value out of the callback, so that I could use it.

Masih
  • 1,633
  • 4
  • 19
  • 38
  • Possible duplicate of [How does evaluateJavascript work?](http://stackoverflow.com/questions/19788294/how-does-evaluatejavascript-work) – Dana Cartwright Sep 16 '16 at 18:30
  • 2
    To be more specific than my duplicate flag: I don't think what you're looking for is possible, since the evaluation is asynchronous. You will just have to cope with the fact that the value is only available in the callback. – Dana Cartwright Sep 16 '16 at 18:31

0 Answers0