How can I show the digits in Arabic format? So, if I have integers: 1,2,3 they become '١', '٢', '٣'
Asked
Active
Viewed 8,259 times
9
-
1Seeing as your profile says that you're from Egypt, I think you might be translating your language's name for digits in the Arabic alphabet incorrectly into English. Those digits are *not* called "Hindi" in English. See https://en.wikipedia.org/wiki/Eastern_Arabic_numerals – Dan Getz Jul 03 '15 at 05:30
-
Thanks @DanGetz I modified the question's title, as mentioned in your wikipedia article, these numbers are sometimes called "Indian numbers". that's where the confusion came from. – Mina Wissa Jul 04 '15 at 22:00
3 Answers
19
set the locale to Arabic, Egypt
NumberFormat nf=NumberFormat.getInstance(new Locale("ar","EG"));
nf.format(i);

Omar Farhat
- 668
- 4
- 15

Mina Wissa
- 10,923
- 13
- 90
- 158
-
Is there a way to translate all digits on our ui resources as well? – Hossein Shahdoost Dec 04 '16 at 12:18
3
int i = 1;
NumberFormat nf = NumberFormat.getInstance(new Locale("hi", "IN"));
nf.format(i);

Max77
- 1,466
- 13
- 19
2
If you want to see your number in persian or arabic format, you must use persian or arabic fonts. With android studio's default font you see them in English format . So do like this: 1. Go to this address File \new \ folder \ assets folder You can create a folder that is named as fonts 2. For your textview or edittext that you want to change it's font should do as this
Typeface face=Typeface.createformatassest (getassest (),"fonts/BZAR.TTF"); Textview.settypeface (face);
Fonts is my folder in assets folder.
If you use persian or arabic fonts your numbers format become to arabic format.

Homa
- 49
- 3