I would like to display something like this:
Dear %s, You have 10% left.
Which would result in:
Dear Johnny Bravo, You have 10% left.
I am using String.format() to format the string for the persons name, but its getting confused with the % in 10% and throwing a MissingFormatArgumentException.
I have tried this
10%
10%
but both ways throw the exception.
If i totally remove the %
or %
then it works fine?
How can I display the % in the text while using String.format
Example Code:
Java
texview.setText(String.format(getString(R.string.lbl_text), user.getName());
strings.xml
<string name="lbl_text">Dear %s, You have 10% left.</string>