Wednesday, May 30, 2012

How to load/use Hindi/Tamil/Gujarati/Marathi font in Android app?

Here are the easy steps to do it.

1- Download droidhindi.ttf file from internet, just do Google search.
Note- Download the ttf file for your Favorite language IE Marathi, Punjabi, Tamil, Gujarati etc.
2- create a simple hello world program using Android SDK and eclipse.
3- Replace the onCreate code by below given  code

 public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Typeface tf = Typeface.createFromAsset(this.getAssets(), "DroidHindi.ttf");
        TextView textView = new TextView(this);
        textView.setTypeface(tf);
        textView.setText("कचजड, कचजड");
        setContentView(textView);
       
    }
4- Copy the droidhindi.ttf file and paste it inside asset folder in eclipse project.
5-See the results