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

11 comments:

  1. Visit www.sarankumarnm.blogspot.com to Download Android Tamil Applications

    ReplyDelete
  2. Hi does it displays the words like शक्ति,शान्ति correctly?

    ReplyDelete
    Replies
    1. Yes, it does display these words properly .. try

      Delete
  3. hi ...in this how can i change size and color and font style of textview....using above java code...
    please help

    ReplyDelete
    Replies
    1. If you type textView. , you will get all the methods to set size,color, font. Just try in Eclipse or Netbeans.

      Delete
  4. how to print sri hanuman in hindi

    ReplyDelete
  5. श्री हनुमान

    ReplyDelete
  6. where can I get font "DroidHindi.ttf"

    ReplyDelete
  7. This comment has been removed by the author.

    ReplyDelete
  8. Thanks sir..to share Very important concept

    ReplyDelete