0

I a content rich application for the Indian market and want to show some text in Hindi (Indian language).

One option is to create image with the text and add the image in the activity. But it becomes too complicated to create and manage images of various sizes.

Is there any way out by which I can display hindi text without messing with the images.

  • Have you tried simply displaying the Hindi text in a `TextView`? – Ted Hopp Feb 17 '13 at 06:03
  • Images are most definitely not the way .. Android supports Unicode, so if anything it's just the rendering of such, [like the choosing the font here](http://stackoverflow.com/questions/8602939/displaying-non-english-specifically-hindi-characters-on-android-device?rq=1) ([and here](http://stackoverflow.com/questions/6759242/hindi-language-support-for-android)). –  Feb 17 '13 at 06:06

2 Answers2

2

You should be able to simply display the text in a TextView. If it does not display correctly, it's probably a font problem. You can package a custom font with your app and use it in a TextView very simply. Just put a .ttf font file (it needs to support Unicode encoding of your text) in your project's ./assets folder and include code similar to this in your activity's onCreate method:

TextView tv = (TextView) findViewById(R.id.view_for_hindi_text);
Typeface font = Typeface.createFromAsset(getAssets(), "MyHindiFont.ttf");
tv.setTypeface(font);
Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
0

You need to have different strings.xml files for different languages.

As shown in the below documentation http://developer.android.com/guide/topics/resources/localization.html

Pretty sure you get out of the box support for Hindi.

smk
  • 5,340
  • 5
  • 27
  • 41