Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
557 views
in Technique[技术] by (71.8m points)

Arabic text support for Android Emulator

I would like to display Arabic text in my Android application. I am developing the application for Android 1.6.

Problem is, when i run the application i can only see square boxes instead of Arabic text.

After google'ing i found the font(*.ttf -true type font) for Arabic has to be added. [ http://www.mydigitallife.info/2010/07/02/how-to-install-and-add-hebrew-arabic-and-unsupported-language-fonts-to-android-phone/ ]. But the solution is for real devices. More over in emulator most of the commands [ex: su,mkdir,chmod etc] are not permitted.

I'm working on windows XP, Eclipse 3.5.2, Android 1.6. All i need is a solution to display Arabic text in emulator.

Any of your effort in this regard is respected from my side:-)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I've got solution from my friend for the above said prob..

And sharing the same here..


If you are having .ttf file then first of all open your project in eclipse and copy .ttf file into the assets folder, which will be in your project hierarchy. and then open .java file where you want to use that font and just follow these steps:-

First
Typeface font1;
TextView txt1;
EditText edtxt;

Second: In onCreate Method just write down this code.

/*here fonttype.ttf is the file which was copied in assets folder.*/

font1 =Typeface.createFromAsset(getAssets(),"fonttype.ttf");
txt1 =(TextView) findViewById(R.id.user_id_txt);
txt1.setTypeface(font1);

edtx = (EditText) findViewById(R.id.editText);
edtx.setTypeface(font1);

by this your problem will solve.


All credits goes to my friend


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...