In the java code(container) i have to get some values by calling some javascript functions, for this im using webView.evaluateJavascript, the problem is that i get the callback only when all the code had already been executed. Is there any way to handle this or any other better alternative?
this is the code:
String[] jsonStringTagResult = new String[1];
//trying to get the value returned by patrolTagToInvoke(tagid)
webView.evaluateJavascript("patrolTagToInvoke('"+tagId+"')", new ValueCallback<String>() {
@Override
public void onReceiveValue(String value) {
jsonStringTagResult[0] = value;
}
});
//the callback from js doesn't arrive in time so jsonStringTagResult will always be null
if (jsonStringTagResult[0] != null || !jsonStringTagResult[0].isEmpty()) {