Set Indian Rupee symbol on text view

Manoj Fegde picture Manoj Fegde · Mar 1, 2013 · Viewed 86.7k times · Source

I am developing an application. And i need to set the symbol of Indian rupee on text view which is set with the text as amount.

Symbol:

enter image description here

I am having the font or .TTF file of this in Assets/fonts folder.

And i tried to use it as :

Typeface typeFace_Rupee = Typeface.createFromAsset(getAssets(),fonts/Rupee_Foradian.ttf");
TextView tvRupee = (TextView) findViewById(R.id.textview_rupee_mlsaa);
tvRupee.setTypeface(typeFace_Rupee);

// Tried to set symbol on text view as follows.
tvRupee.setText("`");

As above setting font i got null pointer error.

In word file after choosing font and typing ` we got the symbol. but it is not working in android.

So what steps should i follow to do this...

Answer

androidgeek picture androidgeek · Mar 2, 2013

enter image description here

Hi use this in Strings

For print rupee symbol: <string name="Rs">\u20B9</string>

For print Rs text: <string name="rs">\u20A8</string>