page loaded but javascript
does not work!
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_poll);
Device.webViewShowPoll = (WebView) findViewById(R.id.webViewShowPoll);
Device.webViewShowPoll.getSettings().setJavaScriptEnabled(true);
//Device.webViewShowPoll.getSettings().setPluginsEnabled(true);
Device.webViewShowPoll.getSettings().setJavaScriptEnabled(true);
Device.webViewShowPoll.getSettings().setPluginState(PluginState.ON);
Device.webViewShowPoll.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
Device.webViewShowPoll.getSettings().setAllowFileAccess(true);
Device.webViewShowPoll.addJavascriptInterface(appconnector, "appConnectr");
try
{
Device.webViewShowPoll.loadDataWithBaseURL("file:///android_asset/",
Utility.convertStreamToString(getAssets().open("index.htm",
AssetManager.ACCESS_BUFFER)), "text/html", "utf-8","");
}
catch (IOException e)
{
Log.e(getString(R.string.app_name), e.getMessage());
}
}
}
AND index.htm is :
<html>
<head>
<script type="text/javascript">
alert('Hello world!');
</script>
</head>
<body>
<p>Hello World!</p>
<p>Hello World!</p>
</body>
</html>