Flash video not displaying in WebView for Android 3.0.1

Xezuka picture Xezuka · Mar 21, 2011 · Viewed 20.7k times · Source

I have a simple WebView to display a website with Flash (the Adobe Flash website) -- testing on a Xoom tablet running Android 3.0.1 with newly released Flash 10.2

After referring to every question on stackoverflow, I've set the following:

mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
mWebView.loadUrl("http://www.adobe.com/software/flash/about/");

Both Plugins and JavaScript are enabled for the WebView using getSettings(), yet Flash fails to show up. When I set setPluginState to ON_DEMAND, it shows the correct placeholder for Flash -- yet again, when I tap the item where Flash should be, the Flash disappears (as if the Flash video is failing to render) and only the audio (depending on the Flash content) can be heard.

I've also noticed that I can tap the missing Flash, do a long-hold tap, then tap the top left where the new Flash 'Fullscreen' button SHOULD be and it'll then show up correctly in Fullscreen mode. But when I fall back to the WebView, it again fails to show up and only plays the audio.

Any thoughts are appreciated! Please don't just refer me back to something posted months ago without some details on why I'm referring to a post months before the Android 3.0 release! Thanks again for any help. Great community!

Answer

Xezuka picture Xezuka · Mar 26, 2011

So after a week and a half+ of searching high and low, trying different techniques, and just about near ready to throw my tablet out the window, I finally figured it out -- and I'm not too happy how EASY it was to fix; then again, I am!

Remember, this was directed toward the ISSUE of Flash video not loading into the WebView on my Xoom Android 3.0.1 tablet with PluginState ON. Read my question and then the answer. Enjoy!

Step 1: Simply add this to the tag under your Applications Manifest XML

android:hardwareAccelerated="true"

Step 2: Load up your app and enjoy your Flash enabled WebView!

Good luck!