Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show Hindi text in android?

I am trying to paste Hindi characters in an array with elements like
String[] arr = {"आपका स्वागत है","आपका स्वागत है"};
but its giving error i.e.
"some characters cannot be mapped using "Cp1252" character encoding"
while saving this.

like image 606
Gkapoor Avatar asked May 02 '11 13:05

Gkapoor


2 Answers

Switch your text encoding to UTF-8.

In Eclipse go to Window -> Preferences, select General -> Workspace. From the Text file encoding dropdown, select UTF-8.enter image description here

like image 160
Jacob Ewald Avatar answered Oct 07 '22 02:10

Jacob Ewald


Thanks i found the solution...

  1. create an array under the value folder
  2. Use the font that support Hindi under the assets folder
  3. textview.setTypeface(Typeface.createFromAsset(getAssets(),"fonts/Hindi.ttf")); its working fine...
like image 28
Gkapoor Avatar answered Oct 07 '22 00:10

Gkapoor