How to show fusion charts in android 2.3.3 devices - android

I am developing an application which requires fusion chart integration with android. Fusion chart is working absolutely fine with API level 3 above but it is not working on 2.3.3 devices.
Screen blinking is there then nothing happens. Please provide a solution for my problem.
If anyone have any sought of sample code then please share it. It will be a great help.
Edited:
public class MainActivity extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView mWeb = (WebView) findViewById(R.id.webView1);
mWeb.getSettings().setJavaScriptEnabled(true);
mWeb.getSettings().setPluginsEnabled(true);
mWeb.loadDataWithBaseURL("", getHTML(), "text/html", "UTF-8", "");
}
private String getHTML() {
String html = "<html><head><script language=\"JavaScript\"src=\"file:///android_asset/FusionCharts.js\"></script></head><body bgcolor=\"#ffffff\"><div id=\"chartdiv\" align=\"center\">The chart will appear within this DIV. This text will be replaced by the chart.</div><script type=\"text/javascript\">FusionCharts.setCurrentRenderer(\"javascript\");var myChart = new FusionCharts(\"file:///android_asset/Column3D.swf\", \"myChartId\", \"400\",\"400\");myChart.setXMLData(\"<graph caption='Title' decimalPrecision='0' formatNumberScale='0' showNames='1' xAxisName='XData' yAxisName='YData' ><set name='One' value='120' color='456553' /><set name='Two' value='345' color='234567' /><set name='Three' value='565' color='098765' /></graph>\");myChart.render(\"chartdiv\");</script></body></html>";
return html;
}
}

It seems the fusion charts are not supported below the Android v. 3.x, as mentioned by one of their staff in this forum on fusioncharts.com.
You may refer to some other chart engines or try this example for implementing chart without using any external jar file. Or you may refer these replies for similar chart engines here and here.
I personally have used AchartEngine and you may refer to this tutorial on how to implement it.

Related

Android DatePicker is so slow in WebView

Below is the WebView code, which shows the webpage at here. Everything works fine. The date picker is so slow, everything else works fine. It takes like 4-5 seconds to select a date. Any alternatives?
public class click extends Activity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.click);
WebView webView = (WebView) findViewById(R.id.webView1);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://www.exceptnothing.com/appointment.html");
webView.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
}
}
I tried adding android:hardwareAccelerated="true" in that activity, same effect still.
I'm a beginner, so simpler code will be appreciated. Thanks in advance :)
try to checkout android DatePickerDialog. Its native and fast way to pick a date on android. Also, using webview in android applications is a bad practice to build a well formed user interfaces, it's realy decreases the application performance, look, and user feel. Native android vidgets are always best to do the work. This tutorial will help you if you decide to build your ui as views layout http://www.tutorialspoint.com/android/android_datepicker_control.htm

Enable All Languages Font in an Application

My application is a simple web view type of app. It just loads a website in one page but I'm having a font issue where on some devices some languages are not supported, is there any solution for this situation?
My code is below:
public class MainActivity extends Activity {
private WebView web1;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
web1=(WebView)findViewById(R.id.web);
web1.getSettings().setJavaScriptEnabled(true);
web1.setWebViewClient(new WebViewClient());
web1.getSettings().setBuiltInZoomControls(true);
web1.loadUrl("http://dcs-dof.gujarat.gov.in/live-info.htm");
}
First please make sure the charset attribute is correctly set in HTTP header or the meta field of the HTML page.
Besides, and the displaying may also depend on the fonts pre-loaded on the specific devices. Although by default most languages are supported in Android AOSP, but as far as I known some manufacturers will remove some characters/languages just in order to save up the disk spaces.
To tackle #2, A tricky way is to install/copy the fonts manually to your device under /system/fonts.

Should I Use CordovaWebView or AndroidWebView in my android native App?

I am making a few simple applications for android platform using Phonegap. I used to use the Android WebView to display the html files put in the assets directory like this ....
public class MyQuiz extends DroidGap
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.loadUrl("file:///android_asset/www/index.html");
}
}
Soon.. I came to know that this can be done using Cordova Web View too. Is there any difference between the two? Like Performance, Look & feel or anything else? Is my approach Right ?
Here are some useful links which will help you out to understand the exact difference between AndroidWebView and CordovaWebView
https://stackoverflow.com/a/11297966/2266525
http://wiki.apache.org/cordova/CordovaWebView
http://docs.phonegap.com/en/2.2.0/guide_cordova-webview_android.md.html

How to view unicode khmer on android?

public class WebKhmer2Activity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
WebView mWebView = (WebView) findViewById(R.id.web);
String source = "អ្នកជាមនុស្ស​ មិនមែនសត្វ";
mWebView.loadDataWithBaseURL("null",source,"text/html","UTF-8",null);
}
}//output just like box it should be អ្នកជាមនុស្ស មិនមែនសត្វ
It's getting easier now, but still not out of the box. There is a group on facebook that has a lot of documentation (because the hacks for Khmer Unicode vary depending on your software and hardware). I would recommend joining the facebook group here. And then check out the files they have for documentation on various methods for getting Khmer Unicode to work on Android here.

how to run local web application in android webview

can anybody tell how to run the local webapplication using android webview
I want to run my own webpages in android using web view
Thanks
I'm guessing you want something like this:
private WebView mWebView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.yourLayoutWithAWebView);
mWebView = (WebView)findViewById(R.id.yourWebViewIdFromTheLayout);
mWebView.getSettings().setJavaScriptEnabled(true); // Enable JavaScript
mWebView.loadData(yourHtmlData, "text/html", "utf-8");
}
Hopefully, that at least points you in the right direction.
Also, I'd recommend reading the documentation on the WebView, it's pretty thorough.
Just run your application on the emulator, as you normally do (and be sure to have your computer connected to internet).

Categories

Resources