我从我的资产折叠中播放swf文件,但我想从我的SD卡中播放...
String html = "<object width=\"1008\"height=\"550\"> <param name=\"movie\" value=\"file:///android_asset/chem1.swf\"> <embed src=\"file:///android_asset/chem1.swf\" width=\"1008\"height=550\"> </embed> </object>";
// <param name=\"movie\" value=\"file:///android_asset/absorptionofmineralsalts.swf\"> <embed src=\"file:///android_asset/absorptionofmineralsalts.swf\"> </embed>";
String mimeType = "text/html";
String encoding = "utf-8";
myWebView = (WebView) findViewById(R.id.swfview);
// WebView wv=(WebView) findViewById(R.id.swfview);
myWebView.getSettings().setSupportZoom(false);
myWebView.getSettings().setJavaScriptEnabled(true);
myWebView.getSettings().setPluginsEnabled(true);
// wv.getSettings().setPluginState(PluginState.ON);
myWebView.getSettings().setAllowFileAccess(true);
WebViewClient webViewClient = new WebViewClient();
myWebView.setWebViewClient(webViewClient);
myWebView.setInitialScale(100);
// wv.loadData(html, mimeType, encoding);
// wv.getSettings().setJavaScriptEnabled(true);
myWebView.loadDataWithBaseURL("null", html, mimeType, encoding, "");
答案 0 :(得分:0)
试试这个:
if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
System.exit(4);
} else {
mWebView.loadUrl("file://" + Environment.getExternalStorageDirectory() + "/swf2.html");
}
如需更多参考,请点击此链接: