6

enter image description here

i have set urdu in textview and apply urdu typeface but is only showing word by word like ب ہ ن

here is code :

Typeface tf1 = Typeface.createFromAsset(this.getAssets(), "Urdu.ttf");
            TextView textView = (TextView)findViewById(R.id.textView1);
            textView.setTypeface(tf1);
            textView.setText("یہ انگریزی نہیں");
Bibi Tahira
  • 1,082
  • 5
  • 15
  • 39

3 Answers3

6

Asaalam-o-alakum bibi Tahira You can downlaod urdu Font from this link,i have tested it.

Thanks

Furqi
  • 2,403
  • 1
  • 26
  • 32
2

For Regional languages you need to read them as UTF-8 and then set the font.

I have followed the below steps and working fine.

  1. Copy the sample URDU text in ms-word. Check the font of it.

  2. Copy the font in assets.

  3. While setting the textview text read it as UTF-8
  4. Apply the font from Assets.
Inzimam Tariq IT
  • 6,548
  • 8
  • 42
  • 69
Vishal
  • 355
  • 3
  • 18
1
 Typeface tf = Typeface.createFromAsset(getAssets(), "fonts/burnstown_dam.otf");
    TextView tv = (TextView) findViewById(R.id.CustomFontText);
    tv.setTypeface(tf);


Typeface tf1 = Typeface.createFromAsset(this.getAssets(), "fonts/Jameel Noori Nastaleeq       Urdu.ttf"");
    TextView textView = (TextView)findViewById(R.id.CustomFontText);
    textView.setTypeface(tf1);
    textView.setText("یہ انگریزی نہیں");
Muhammad Usman Ghani
  • 1,279
  • 13
  • 19
  • i am getting data from database and need to display that data in urdu in textview may i need to put that in urdu in SQlite ? and also how can i show in urdu font in textview android please help me – Erum Feb 25 '14 at 20:20
  • above code is for getting font from asset folder you have to check this link http://stackoverflow.com/questions/16306702/reading-data-from-sqlite-database-in-android-application – Muhammad Usman Ghani Feb 26 '14 at 08:39
  • http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ – Muhammad Usman Ghani Feb 26 '14 at 08:39
  • but may i need to insert data in sqlite db in urdu ? or it will automatically convert my text in urdu – Erum Feb 26 '14 at 18:18
  • sorry i did not try this, but i think so it is possible in db. see my blog http://usmansaleem.blogspot.com/ i had complete this assignment using java frame. – Muhammad Usman Ghani Feb 27 '14 at 07:42