How to view unicode khmer on android? - 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.

Related

Android assets webview saying web page not available

Got this code from a Eudonix news reader tutorial and everything looks fine but still coming up with webpage not available, tried on emulator and device still same thing.
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
webViewHome.getSettings().setJavaScriptEnabled(true);
setWebViewSettings();
webViewHome.addJavascriptInterface(new JavaScriptMenuHandler(this), "menuHandler");
webViewHome.loadUrl("file:///android_asset/home.html");
}
Anyone know what might be wrong?

Eclipse Android App Zoom In Code WebView

I'm very new to developing android apps. I've edited this app I found, which was open source and have got it working to a good extent. There's some code that isn't being used at all (Like the preferences menu) but I haven't removed that as I simply don't want to mess it up. Anyway, when I view the website it's zoomed in.. I've researched the problem and found a few ways to fix it, but none have worked. The app files can be downloaded at this link: http://www.megafileupload.com/en/file/504860/App-zip.html
Thanks for any help!
Now, here's where the answer comes in.
You get the settings for your webview before you instantiate it. You need something like:
void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dashboard); // do this first
WebView webView = (WebView) findViewById(R.id.yourwebviewid); // either this or
either the above to tie the Java object to an xml object
or create a view and add it to some parent
View parent = (View)findViewById(R.id.yourparent_layout_for_webview); // this
WebView webView = new WebView();
parent.add(webView);
webView.getSettings().setBuiltInZoomControls(true);

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.

How to show fusion charts in android 2.3.3 devices

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.

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