简体   繁体   中英

When loading swf file blank screen appears

I used the following code to load swf file , but it shows a blank screen.

In manifest I have mentioned android:hardwareAccelerated="true"

My code is as follows :

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mWebView = (WebView) findViewById(R.id.webView1);
    mWebView.setFocusable(true);
    mWebView.setFocusableInTouchMode(true);
    mWebView.getSettings().setJavaScriptEnabled(true);
    //mWebView.getSettings().setPluginState(PluginState.ON);
    mWebView.getSettings().setPluginsEnabled(true);

    Log.d(TAG, "before loading url");
    mWebView.loadUrl("file:///android_asset/carspeakers.swf");

    Log.d(TAG, "after loading url");

}

Try this..

Add the below line and try..

mWebView.getSettings().setAllowFileAccess(true);

Hope this will help..

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