0

In strings.xml file I have the following entry -

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

Now in my activity_main.xml file when I have the entry -

android:text="@string/Rs"

the output on device is correctly shown as "₹"

But when I have the entry -

android:text="Pizza @string/Rs 350"

the output on my device is incorrectly shown as "Pizza @string/Rs 350"

How to correct this?

Payel Senapati
  • 1,134
  • 1
  • 11
  • 27

2 Answers2

0

You have put the following code in your strings.xml file -

<string name="pizza_price">Pizza \u20B9350</string>

and you have to put the following code in your activity_main.xml file -

android:text="@string/pizza_price"

Source - Concatenate multiple strings in Android Studio xml

Payel Senapati
  • 1,134
  • 1
  • 11
  • 27
-1

You can use this way for example you have user name and you want to store it as a string like this <string name="user_name">User Name </string>