how to add font in Android Application

Prashant Kadam picture Prashant Kadam · Jun 24, 2011 · Viewed 13.8k times · Source

i am making one application in Android 2.2 in that application i want to show hindi text in TextView in Android application. (how to add "मैं छात्र हूँ" word in Text view)

Please help me..

Answer

Jana picture Jana · Jun 24, 2011

Add your font to assets folder in your project and use the below snippet

 TextView hindiTextView=(TextView)findViewById(R.id.txtbx);
 Typeface hindiFont=Typeface.createFromAsset(getAssets(),"fonts/fontname.ttf");
 mytextView.setTypeface(hindiFont);

Hope its helpful.