Greum
Well-Known Member
I'm trying to get mybrain around using placeholders with a textView. Instead of simply displaying "VAT" I want to show "VAT at 20%" (or whatever the rate is).
I currently have in my strings.xml
<string name="vat_text">VAT</string>
and in my Java
textView16.setText(R.string.vat_text);
I have changed the entry in strings.xml
<string name="vat_text">VAT at %d</string>
and tried in my Java
textView16.setText(getString(R.string.vat_text, vatPc));
but this gives a runtime error (which I couldn't catch as there were dozens of other errors afterwards.
I currently have in my strings.xml
<string name="vat_text">VAT</string>
and in my Java
textView16.setText(R.string.vat_text);
I have changed the entry in strings.xml
<string name="vat_text">VAT at %d</string>
and tried in my Java
textView16.setText(getString(R.string.vat_text, vatPc));
but this gives a runtime error (which I couldn't catch as there were dozens of other errors afterwards.