开发者

android 2.2 open swf in browser

I have a swf file on the sdcard and I wrote a html file flash.html with the swf file embeded. The only way to open it now is开发者_JS百科 1) open the browser 2) type in file:///sdcard/flash.html The swf runs fine.

But if use the code list below:

Uri uri = Uri.parse("file:///sdcard/flash.html");   
Intent intent = new Intent(Intent.ACTION_VIEW, uri);   
startActivity(intent);  

It shows the error: The application has stopped unexpectly.

I also tried the following code using WebView:

WebView browser = (WebView) findViewById(R.id.list_web);   
browser.loadUrl("file:///sdcard/flash.html");                                

The Webview showed up, but the area should start the swf is empty.

So is there a way to open the html through code, how can I do it?

I also think if there is a way to open the android browser using ACTION_VIEW by a simple html then reset the URL through code?


"I also think if there is a way to open the android browser using ACTION_VIEW by a simple html then reset the URL through code?"

Maybe you can open an HTML file which then redirects to the .swf using a <meta> tag or Javascript. (That would only work if the user has JS turned on though.)

Odd that you can't open a SWF that way normally. Sounds like a bug you should report.


If you're running 2.2, you can just open the file directly.

file://sdcard/whatever.swf
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜