this code worked fine since I updated to API 19 and the method setPluginsEnabled(true) from the type WebSettings is now deprecated.
I faced that the method setPluginState(PluginState.ON) would be a solution but it is deprecated too.
What could i do? I found these posts A, B,C that some people had a similar issues, but those answers didnt help me :/ Although the compiler gives me a warning, it compiled successfully. (that's why its going to be deprecated, but it is not yet. Same happened with setPluginEnabled, am I ok?)
Basically what I need to do is show a graphic chart of sells loading the data from a db.
private void updateChartDataSet(){
Enumeration<Integer> enumerator = this.values.keys();
while(enumerator.hasMoreElements()){
Integer key = enumerator.nextElement();
Double value = this.values.get(key);
this.diasJsonArray.put(DateUtils.convertGraficoVentasMensualDateToString(dateValues.get(key)));
this.montosJsonArray.put(value);
}
}
private void setWebViewData(){
this.webView.getSettings().setJavaScriptEnabled(true);
this.webView.getSettings().setBuiltInZoomControls(true);
this.webView.getSettings().setPluginsEnabled(true);
this.webView.addJavascriptInterface(new GraficoWebAppInterface(diasJsonArray,montosJsonArray, "Ventas Mensual", "Venta del día"), "dataLoader");
this.webView.loadUrl("file:///android_asset/charts/VentasClientes/chart.html");
this.webView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url){
return false;
}
});
android_asset/charts/VentasClientes/chart.html:
<script src="jquery-1.9.1.min.js"></script>
<script src="highcharts.js"></script>
<div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
<script>
$(function () {
$('#container').highcharts({
chart: {
type: 'bar'
},
title: {
text: dataLoader.getTittle()
},
xAxis: {
categories: eval(dataLoader.getCategories()),
title: {
text: null
}
},
yAxis: {
min: 0,
title: {
text: 'Monto ($)',
align: 'high'
},
labels: {
overflow: 'justify'
}
},
tooltip: {
valueSuffix: '$'
},
plotOptions: {
bar: {
dataLabels: {
enabled: true
}
}
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'top',
x: -100,
y: 100,
floating: true,
borderWidth: 1,
backgroundColor: '#FFFFFF',
shadow: true
},
credits: {
enabled: false
},
series: [{
name: dataLoader.getSerie(),
data: eval(dataLoader.getData())
}]
});
});
</script>