0

Encoding Urdu in Android

I want to develop an application , in which i want to store Urdu string into SqlLite database, i need to input Urdu Characters into EditText so i can copy and insert into Database, and like wise, i want to display Stored Urdu data into EditText or in List Column

Adil Soomro
  • 37,609
  • 9
  • 103
  • 153
  • Look at posts [here](http://stackoverflow.com/questions/5804622/certain-arabic-text-gets-incorrectly-shown-while-other-arabic-text-gets-showed-no/5804685#5804685),[here](http://stackoverflow.com/questions/5403615/getting-arabic-text-from-txt-file/5403734#5403734) and [here](http://stackoverflow.com/questions/5730637/android-application-arabic-support/5731344#5731344) – Adil Soomro Sep 20 '11 at 11:10

1 Answers1

3

To do this we need the font file for Urdu fonts. For example ,we have the Urdu font file name as urdufont.ttf. Save this file into the assets folder then use the bellow code

edittext.setTypeface(Typeface.createFromAsset(getContext().getAssets(),"urdufont.ttf"));
dittext.setText("ur text");

Like wise we can set any type of text with out using the Locale

first download the urdu font file from intetnet ,then follow the above instructions.

Balaji.K
  • 8,745
  • 5
  • 30
  • 39
  • tnx for the info, the msgs can come in eng and urdu both so how to detect that msg is in urdu and then set the typeface accordingly ...? – Dakait Dec 11 '13 at 09:13