When you are going to develop a localized app in Sinhala the biggest problem you are facing is Sinhala support for android. So here you can find simple example how to use Sinhala fonts with your android app. For the coding example I am using Amal Sinhla font,
First start a new Android project( In Eclipse go to New -> Other -> Android -> Android Project ). Then place your Sinhla font TTF file (Amal.TTF) in the ./assets directory. Create it if it doesn’t exist. Following figure show you how it looks after you add it.
Now you can do coding. Change the main.xml file as follows.
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/sinhala_font" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="wdhqfndajka" android:textSize="25sp" /> </LinearLayout>
Add following code lines to main activity class.
TextView txt = (TextView) findViewById(R.id.sinhala_font); Typeface font = Typeface.createFromAsset(getAssets(), "amal.TTF"); txt.setTypeface(font);
Every thing is done. You can run the project. It will look like as shown in the bellow figure. Now you can develop a Sinhala enable android app easily. You can add not only Sinhala fonts like this but also any customized font.