我已经按照下面链接中给出的示例程序将 WebView 放置在 Dialog 中。 http://www.41post.com/4673/programming/android-creating-a-webview-dialog
应用程序运行良好。但是如果我启用插件 (setPlauginsEnabled(true)); 应用程序给出异常。问题仅存在于具有 Flash 内容的网站。
以下是部分代码,*
webView.getSettings().setPluginsEnabled(true);
//Set the user agent
webView.getSettings().setUserAgentString("AndroidWebView");
//Clear the cache
webView.clearCache(true);
//Make the webview load the specified URL
webView.loadUrl("http://www.coca-cola.com/en/index.html");
*
下面是代码跟踪,
E/AndroidRuntime( 1868): FATAL EXCEPTION: main
E/AndroidRuntime( 1868): java.lang.ClassCastException: android.view.ContextThemeWrapper cannot be cast to android.app.Activity
E/AndroidRuntime( 1868): at com.adobe.flashplayer.FlashPaintSurface.getBrowserActivity(FlashPaintSurface.java:650)
E/AndroidRuntime( 1868): at com.adobe.flashplayer.FlashPaintSurface$2.surfaceCreated(FlashPaintSurface.java:208)
E/AndroidRuntime( 1868): at android.view.SurfaceView.updateWindow(SurfaceView.java:533)
E/AndroidRuntime( 1868): at android.view.SurfaceView.access$000(SurfaceView.java:81)
E/AndroidRuntime( 1868): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:169)
E/AndroidRuntime( 1868): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:590)
E/AndroidRuntime( 1868): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1617)
E/AndroidRuntime( 1868): at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2446)
E/AndroidRuntime( 1868): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1868): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime( 1868): at android.app.ActivityThread.main(ActivityThread.java:4424)
E/AndroidRuntime( 1868): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1868): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime( 1868): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
E/AndroidRuntime( 1868): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
E/AndroidRuntime( 1868): at dalvik.system.NativeStart.main(Native Method)
W/ActivityManager( 1117): Force finishing activity fortyonepost.com.webviewdialog/.WebViewDialogActivity