I’m using a webview in my android application, and the web address that the webview loads contains some JavaScript. Now, I just want to know if it is possible to pass in some variable values from my Java Code to my JavaScript.
Here’s my code:
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.map_layout);
webView = (WebView) findViewById (R.id.webview);
WebSettings webViewSettings = webView.getSettings();
webViewSettings.setJavaScriptEnabled(true);
webView.addJavascriptInterface(new transferPlaceId(), "Android");
webView.loadUrl("http://webaddress.com/directory/page.html");
}
Javascript Interface works well, no need to worry about it.
Any help will be much appreciated. Thanks in advance!
Yes, you can