ChildBrowser.java语法错误

时间:2013-09-19 22:24:38

标签: java android cordova childbrowser

在ChildBrowser.java(2.0.0)中 行:356 Cordava:2.9.0

是语法错误:

对于WebSetting类型,未定义方法setPluginsEnabled(boolean)

                // WebView
       webview = new WebView(ctx.getActivity());
       webview.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
       webview.setWebChromeClient(new WebChromeClient());
       WebViewClient client = new ChildBrowserClient(edittext);
       webview.setWebViewClient(client);
       WebSettings settings = webview.getSettings();
       settings.setJavaScriptEnabled(true);
       settings.setJavaScriptCanOpenWindowsAutomatically(true);
       settings.setBuiltInZoomControls(true);


       settings.setPluginsEnabled(true);


       settings.setDomStorageEnabled(true);
       webview.loadUrl(url);
       webview.setId(6);
       webview.getSettings().setLoadWithOverviewMode(true);
       webview.getSettings().setUseWideViewPort(true);
       webview.requestFocus();
       webview.requestFocusFromTouch();

我不知道如何删除它。

感谢您的帮助。

TB

1 个答案:

答案 0 :(得分:4)

随着Android 4.3(API级别18)的推出,您正在寻找的方法已被弃用并从公共API中删除:

/**
 * Sets whether the WebView should enable plugins. The default is false.
 *
 * @param flag true if plugins should be enabled
 * @deprecated This method has been deprecated in favor of
 *             {@link #setPluginState}
 * @hide Since API level {@link android.os.Build.VERSION_CODES#JELLY_BEAN_MR2}
 */
@Deprecated
public synchronized void setPluginsEnabled(boolean flag) {
    throw new MustOverrideException();
}

Link to source code

正如上面的Javadoc所指出的,启动API级别18,您可以使用以下方法,并传入PluginState.ON

setPluginState(WebSettings.PluginState state)

请注意,此方法也已弃用,说“将来不再支持插件,不应使用。”Link.

这是实际的API 18 diff report for WebSettings,可以方便地概述课程的所有变化。