Manish Srivastava
Manish Srivastava

Reputation: 1659

Flash is not loading in Web view in Android

I am trying to Load a webview in Android. Where web page have a swf file but it is not loading. I know there are many question and answer on same topic but no one helped me.

I have already targeted it version 11. And I have put android:hardwareAccelerated="true" too in manifest.xml file.

enter image description here

My code is here-

public class MainActivity extends Activity {

    private WebView mWebView;

    String url="http://mypages.com/Ch_001/ScoPage.html";

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

        mWebView = (WebView) findViewById(R.id.webView);
        mWebView.setKeepScreenOn(true);
        WebSettings settings = mWebView.getSettings();
        settings.setPluginState(PluginState.ON);

        mWebView.getSettings().setJavaScriptEnabled(true);
        mWebView.getSettings().setDomStorageEnabled(true);
        mWebView.getSettings().setBuiltInZoomControls(true);
        mWebView.setInitialScale(100);
        // wbView.getSettings().setUseWideViewPort(true);
        mWebView.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
        mWebView.setWebViewClient(new MyWebViewClient());


    }
    private class MyWebViewClient extends WebViewClient {
        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
        }

        @Override
        public void onReceivedSslError(WebView view, SslErrorHandler handler,
                SslError error) {
            Log.e("Error VAGARO", error.toString());
            handler.proceed();
        }

        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return false;
        }
    }



}

Upvotes: 6

Views: 11657

Answers (3)

Manish Srivastava
Manish Srivastava

Reputation: 1659

After one week struggle I got a Flash player from Macromedia, which works for me.

  1. You can search in Google for-"Flash Player 11.1.for Android 4.0 - Macromedia - Adobe" or install APK from this link.

  2. Install this apk in your Android device.

  3. And when you will open it, it will ask for choose default browser.

  4. Choose any browser which support Flash (UC-Browser, Chrome etc).

  5. Now run your any application it will load your Flash video.

Upvotes: 7

TheLittleNaruto
TheLittleNaruto

Reputation: 8473

Add this code:

webview.getSettings().setPluginsEnabled(true);

Upvotes: 3

lialzmchina
lialzmchina

Reputation: 10

add mWebView.loadUrl(url);in onCreate

Upvotes: -3

Related Questions