I have two unfocused TextView
in the single layout. I want to show Arabic text on one TextView
and English text on another TextView
. I have use values/strings.xml
for English and values-ar/strings.xml
for Arabic text. My problem is Arabic text not showing in the TextView
. If I change the custom locale to ar
means its showing. How to show the Arabic text without changing the custom locale?
Asked
Active
Viewed 9,207 times
0

Ahmed Aswani
- 8,271
- 7
- 33
- 54

bharath
- 14,283
- 16
- 57
- 95
-
If you want to show the Arabic text irrespective of the locale then why are you storing it in a locale specific file (`values-ar/strings.xml`)? – Mudassir Sep 14 '11 at 13:03
-
Its not a single word or single paragraph. I have multiple categories and need to show for selected category. – bharath Sep 14 '11 at 13:25
-
Follow this helpful [link](http://stackoverflow.com/questions/7962704/how-to-support-arabic-text-in-android/7962813#7962813) and enjoy! There is a complete description of problem and an algorithm as its solution. – Bob Nov 01 '11 at 08:18
3 Answers
2
Put both arabic and english text in each strings.xml

Caner
- 57,267
- 35
- 174
- 180
-
Thanks Las. and its i know already. My problem is i have same list of category for english and arabic. So i use the category name as key. Also every category description is in big paragraph. – bharath Sep 14 '11 at 12:57
1
Its default behaviour for Android. It will take locale information from system and map appropriate string resource from values-ar. Text you want to show in Arabic you have to take entry in values/strings.xml and have to put those arabic character that you want to display.
please share the result when you tried this.

Roll no1
- 1,315
- 1
- 16
- 23
1
To do this we need the font file for Arabic fonts. For example ,we have the Arabic font file name as arabicfont.ttf. Save this file into the assets folder then use the bellow code
arabicTextview.setTypeface(Typeface.createFromAsset(getContext().getAssets(),"arabicfont.ttf"));
arabicTextView.setText("ur text");
Like wise we can set any type of text with out using the Locale

Balaji.K
- 8,745
- 5
- 30
- 39
-
-
arabicTextView.setText("ur text"); here for arabic text text will be written in english ? – Erum Jan 30 '15 at 16:17