title: Android webview: how to obtain result of evaluateJavascript in a method that invokes evaluateJavascript?
body: <p>As we know in Android, if we want to obtain the result returned by JavaScript code invocation, we can use <code>webview.evaluateJavascript()</code>. For example:</p>
  
  <pre><code>webview.evaluateJavascript("1+2", new ValueCallback&lt;String&gt;() {
       public void onReceiveValue(String value) {
          //value should be 3
       }
  });
  </code></pre>
  
  <p>However, how can I further obtain the result in a method that invokes <code>evaluateJavascript</code>? For example:</p>
  
  <pre><code>public void myFunc() {
     String s;
     webview.evaluateJavascript("1+2", new ValueCallback&lt;String&gt;() {
       public void onReceiveValue(String value) {
          s = value; //This line is only for illustration, it is not syntactically correct
       }
    });
    //Use s to do other things
  }
  </code></pre>
  
  <p>Of course the above snippet doesn't work, but is it possible to achieve similar functionality?</p>
  
  <p>Thanks!</p>