I have two string resources. The first in the main values is in English and does not have a string argument:
<string name="example">Have a good day!</string>
But in French, with-fr values, we have another phrase with one argument, for example:
<string name="example">Bonne journée M. %1$s!</string>
How to use resource string formatter? This works, but it does not seem correct (and it generates a line warning):
textView.setText(getString(R.string.example, name));
The lint warning is "StringFormatInvalid", and the description of the "Format string" example 'is not a valid format string, so it cannot be passed to String.format "
source share