0

my android application uses facebook api to read latest FB status update of the user.but some of them are written in local languages like Hindi,Malayalam,Tamil (eg: ശിഖര്‍ ധവാന്‍ , രോഹിത് ശര്‍മ, വിരാട് കോലി, സുരേഷ് റെയ്‌ന, അജിങ്ക്യ രഹാനെ,सभी को सुप्रभात)etc.how to make all these text readable while displaying in a textview?

sajith
  • 2,564
  • 8
  • 39
  • 57

1 Answers1

1

I would assume that the default Android font (Roboto since ICS) doesn't include Hindi, Malayalam and Tamil. At least I'm not able to find evidence that it does. Judging from this post Jellybean ships with a font with support for Malayalam (and possibly others). Still, you need to explicitly specify the use of this font if you wish the text to render properly in a textview or similar. To set a specific TypeFace you can use TextView.setTypeface(). I would suggest that you bundle the font mentioned in the link above in your assets folder and load it like this:

TypeFace tf = Typeface.createFromAsset(context.getAssets(), "AnjaliNewLipi-light.ttf")

You might want to look into caching the TypeFace to prevent memory leaks on older Android versions. Resuse this class if you wish.

Also, for advanced use, you can make your TextViews, Buttons etc styleable via XML by following the instructions in this answer.

Community
  • 1
  • 1
britzl
  • 10,132
  • 7
  • 41
  • 38