Farnad Tohidkhah Farnad Tohidkhah - 5 months ago 24
Android Question

How to display Persian(Farsi) numbers in views

I want to display Persian(Farsi) numbers on views. For example I calculated a date and converted it to Jalali calendar but how can I display it by Persian numbers?

Answer

By using Typeface class the font type of a view can be changed to Farsi font so the numbers can be showed by Farsi fonts :

Typeface typeface=Typeface.createFromAsset(getAsset(), "FarsiFontName.ttf");
myView.setTypeface(MainActivity.typeface);
Comments