Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flash in an Android WebView - layering issue

I am trying to have interactive buttons in an android WebView that contains flash. As a test, I set up a HTML to load in a flash through with a set x/y size.

public class webz extends WebView {
private Drawable image;
public webz(Context context, AttributeSet attrs) {
    super(context, attrs);
    image=context.getResources().getDrawable(R.drawable.icon);
    getSettings().setPluginsEnabled(true);
}
@Override
protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);
    image.setBounds(100, 300, 150, 450);
    image.draw(canvas);
}

}

I set up a test image that would overlay itself half over the flash, half over the unused canvas. once loaded, the flash will load over the canvas draw, leaving only the part over the HTML.

LINK TO SCREENSHOT

the answer to this question states that adobe's flash player creates a surfaceview inside of the webview. i assume this is the cause of the layering issue, but i have no idea how to overcome it.

does anyone know how to override this? the button has to also send key events to the flash (like you press the on screen button, and the A key to sent to the flash). if you know how to do this as well, it would be very helpful

like image 628
corey Avatar asked Apr 13 '11 04:04

corey


1 Answers

Add your button to a layout and then set the layout to a dialog using setcontentview. When your activity is loaded, show your dialog as full screen transparent dialog.

like image 176
Vinoth Avatar answered Sep 26 '22 05:09

Vinoth