Flash in a WebView

Search This thread

alexcq

Member
Aug 26, 2009
5
0
Ooops I posted this to the main Hero forum yesterday by mistake - it is more properly and Android developer post specific to the Hero. . . .

I've been trying to run Flash in a Webview on my Hero.

Flash runs in the standard Browser okay, but I get the 'missing plugin' icon when trying to view anthing with Flash in the WebView.

I'm not sure if it has been disabled, or I just haven't found the right settings. I'm using the standard,

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

Then I'm also calling (through reflection) the 'setFlashPlayerEnabled' method described by cyanogen
http://xdaforums.com/showthread.php?t=521221

//Set Flash Player Enabled
Boolean[] input={new Boolean(true)};
try{
Class cl=Class.forName("android.webkit.WebSettings");
Class[] par=new Class[1];
par[0]=Boolean.TYPE;
Method mthd=cl.getMethod("setFlashPlayerEnabled",par);
mthd.invoke(mWebView.getSettings(),input);
mWebView.loadUrl("file:///android_asset/index.html");
}catch(Exception e){}

But still no Flash in the WebView.

Is there anything else that needs to be called?

How about
setPluginsPath("")

. . . . what path should that call on the Hero?
 

alexcq

Member
Aug 26, 2009
5
0
Thanks for that - generally I'm using

mWebView.loadUrl("http://www.google.com/"+e.toString());

while debugging on the device to have any errors sent to the URL bar. A bit nasty, but it gets me the info. :)
 

cchiro

New member
Aug 19, 2010
1
0
Android 2.2 Flash in a WebView

Hi,
I just tried loading a swf in a WebView and it seems to be working. I needed to enable setPluginsEnabled(true); which I saw in your post. Thanks.
 

royiby

Member
Aug 1, 2010
7
0
let me guess - Android version is 2.1 or lower

I came to that conclusion after i noticed that on my N1 running 2.2 this works flawlessly but on my Evo running 2.1 it shows gibberish.

am i correct?
 

Waza_Be

Inactive Recognized Developer
Jul 22, 2009
822
234
Sep 4, 2014
20
0
indore
Flash content loading fine in webview, but in postDelayed thread it freezes.

Webview get stuck/freezes when i continuously load multiple webviews in a runnable thread in android having flash content.
How can i continue rendering my webview in thread . right first it loads fine and then it start rendering slow and then after a point it freezes.