Question

I'm developing a browser for Android.

Is it possible to create a Checkbox Preference to enable and disable Flash plugin (webview.setPluginsEnabled) in the Preferences?

<CheckBoxPreference
android:title="Enable/Disable Flash"
android:key="chkbox_flash"

Here I need the code to set WebView.getSettings().setPluginsEnabled(boolean) 
to true or to false />
Was it helpful?

Solution

I don't develop to Android, but seems you should add a listener to your CheckBoxPreference like this checkboxpreference-onclick (docs)

Then you set the state of the plugin off. Heres the doc. Basically, you have to do:

WebView webview = new WebView(this);
webview.getSettings().setPluginState(PluginState.OFF);

You shouldn't use setPluginsEnabled, as it is deprecated. Note, though, it'll disable any plugins, not only Flash.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top