-6

I want to display hindi text. The hindi data is fetched from the database sqlite, the same value when fetched from database , displays the word incorrectly though the font in the db in the correct hindi format.

Anthony Johnston
  • 9,405
  • 4
  • 46
  • 57
messa2703
  • 1
  • 6
  • God knows that the words may be in hindi & u fetched them in french format. How can one know without looking at what your code is – Syed Nazar Muhammad Sep 10 '15 at 11:44
  • tf = Typeface.createFromAsset(getAssets(), "fonts/DroidHindi.ttf"); textHeader.setTypeface(tf); textHindiWebLink.setTypeface(tf); textHeader.setText("कोंकण रेलवे"); textHindiWebLink.setText("हिंदी वेबसाइट"); the first textview diplays properly , the second does not – messa2703 Sep 11 '15 at 05:07

2 Answers2

3

What you can do is copy a hindi font into your assets folder and create a custom typeface and apply that to the textView.

Example:

Typeface font = Typeface.createFromAsset(getAssets(),"font.ttf");
TextView text = (TextView) findViewById(R.id.appName);
text.setTypeface(font);
whit3hawks
  • 429
  • 7
  • 14
2

For Eclipse IDE : below is path to configure the encoding :

Preferences > General > Workspace > Text file encoding "Choose utf-8"

  • create an array under the value folder
  • Use the font that support Hindi under the assets folder
  • textview.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/Hindi.ttf")); its working fine
  • for type hindi fastly use Google Inputtools for windows os Download Here
Neeraj Kumar
  • 3,851
  • 2
  • 19
  • 41