Created
April 26, 2017 12:57
-
-
Save Ansh1234/a7bed39fd7ada25920a91a32f1c5bb55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void callJavaScriptFunction(final WebView webView, final String script) { | |
if (webView == null) { | |
return; | |
} | |
webView.post(new Runnable() { | |
@Override | |
public void run() { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { | |
webView.evaluateJavascript(script, new ValueCallback<String>() { | |
@Override | |
public void onReceiveValue(String value) { | |
} | |
}); | |
} else { | |
webView.loadUrl("javascript:" + script); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment