简体   繁体   中英

android application - android emulator virtual sd card - swf file not loading

I want to display an swf file in my android application.

For testing purposes am using android emulator . So i created a virtual sd card for the application to read the files.Inside this sd card i put my swf file and am trying to open the swf file in my code.

Am not getting any error on log cat, but getting a blank screen .

Following my code displaying swf on WebView.

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
         setContentView(R.layout.loadswf);
            String html =
                "<object width=\"550\" height=\"400\"><param name=\"movie\" value=\"file:///Demo_mobile.swf\">" +
                "<embed src=\"file:///Demo_mobile.swf\" width=\"550\" height=\"400\"> </embed> </object>";
                String mimeType = "text/html";
                String encoding = "utf-8";
            WebView wv=(WebView) findViewById(R.id.webview);
            wv.getSettings().setJavaScriptEnabled(true);
            wv.getSettings().setPluginsEnabled(true);
            wv.loadDataWithBaseURL("null", html, mimeType, encoding, "");
            wv.setWebViewClient(new HelloWebViewClient());

    }

Experts please give me a solution for this issue.??

Try below code, that may helpful to you!

    mWebView = (WebView) findViewById(R.id.webview);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setPluginsEnabled(true);

You can then load data into the webview like so

    String html = "<object width=\"550\" height=\"400\"> <param name=\"movie\" value=\"file:///sdcard/flash/2204355.swf\"> <embed src=\"file:///sdcard/flash/2204355.swf\" width=\"550\" height=\"400\"> </embed> </object>";
    String mimeType = "text/html";
    String encoding = "utf-8";

    mWebView.loadDataWithBaseURL("null", html, mimeType, encoding, "");

I simply made custom html inside the program and told it to load a flash file that I had stored in the flash folder on my sdcard.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM