And also "String literal in setText cannot be translated "
Now there are posts on this, but nothing seems working for me. Or need a proper explanation. How to use string resources Getting warning on this
pTxt.text = "Total : $ $price"
Here, price is a value
if use this
pTxt.setText(R.string.displayPriceMsg, price)
it gives an error.
tried String.format() but giving garbage value.
Have this in strings.xml
<string name="displayPriceMsg">Total : $ %1$d</string>
You have to pass format arguments to the getString
method:
pTxt.text = context.getString(R.string.displayPriceMsg, price)