0

Im trying to playing a swf file via a webview.

This is the java code :

    screen = (WebView)findViewById(R.id.screen);

    String url = "file:///android_asset/web.html";

    //screen.getSettings().setAllowFileAccessFromFileURLs(true);
    screen.getSettings().setAllowFileAccess(true);
    screen.getSettings().setJavaScriptEnabled(true);
    screen.getSettings().setAppCacheEnabled(true);
    screen.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
    screen.loadUrl(url);

And this is the web.html :

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html" charset="UTF-8" />
</head>
<body>
<object width="215" height="140">
      <param name="movie" value="act1.swf">
        <embed src="file:///android_asset/act1.swf"
               width="215" height="140">
        </embed>
</object>
</body>
</html>

Both of the html and swf file is in my assets folder.

Its pretty straight and simple, i got it from here and this question. Im trying to run the apps in my android phone (2.3.3), but the webview dont display anything.

I checked the log cat, yet theres nothing there. I think i missed something, but i stuck here.

Any help is appreciated, Thanks for your help :D

Community
  • 1
  • 1
Blaze Tama
  • 10,828
  • 13
  • 69
  • 129

1 Answers1

0

All i need is just adding screen.getSettings().setPluginsEnabled(true);, and the swf file will be shown :D

Blaze Tama
  • 10,828
  • 13
  • 69
  • 129