3

How can I display the new Rupee (Indian) symbol in TextView?

Mithical
  • 603
  • 1
  • 17
  • 28
Ahmed Faisal
  • 4,397
  • 12
  • 45
  • 74
  • try using https://gist.github.com/john1jan/a82912fb355771e565bea1720439c5dc . It prefixes rupee symbol and adds even give comma separated amount – John Jul 08 '16 at 07:01

5 Answers5

19

you can use

<string name="Rs">\u20B9</string>  

\u20B9 is 'Rupee Symbol'

or

<string name="rs">\u20A8</string> 

\u20A8 is 'Rs'

bilash.saha
  • 7,226
  • 2
  • 35
  • 40
  • Hi i tried the same thing to display Rupees Symbol in android and tried to access like this: currencySymbol = mContext.getResources().getString(R.string.str_symbol_rs);. but its showing Rectangle like its not recognized that unicode. i tested on Samsung Galaxy ace. – Raj Apr 07 '13 at 07:47
  • try using https://gist.github.com/john1jan/a82912fb355771e565bea1720439c5dc . It prefixes rupee symbol and adds even give comma separated amount – John Jul 08 '16 at 07:02
7

enter image description here

<?xml version="1.0" encoding="utf-8"?>
 <resources>

  <string name="app_name">Currency</string>
  <string name="us">\u0024</string>
  <string name="Rs">\u20B9</string>

</resources>
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
Dhina k
  • 1,481
  • 18
  • 24
  • Please don't post identical answers to multiple questions. Post one good answer, then vote/flag to close the other questions as duplicates. If the question is not a duplicate, _tailor your answers to the question_. – kleopatra Sep 10 '15 at 08:42
  • try using https://gist.github.com/john1jan/a82912fb355771e565bea1720439c5dc . It prefixes rupee symbol and adds even give comma separated amount – John Jul 08 '16 at 07:02
4
Textview indian;
indian.setText("\u20B9 10,000");

output :

₹ 10,000

Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131
saigopi.me
  • 14,011
  • 2
  • 83
  • 54
0

You have to just save the rupee symbol in a string as shown below:

String string = "\u20B9";

Now you can use this anywhere you want in your code like toast or in anything else.

Edric
  • 24,639
  • 13
  • 81
  • 91
0

If you want to display the rupee symbol along with a value, the value can be formatted accordingly. To change an amount to Indian Rupees format in kotlin (this adds the symbol also), use the NumberFormat class with getCurrencyInstance().

val formattedAmount = NumberFormat.getCurrencyInstance(Locale("en", "IN")).format(amount)

The amount variable is the value in double.

SPT
  • 1