Issue
This shows the integer fine <string name="count"> Count %d </string>
Example output: Count 3
however this does not, <string name="count"> Count ( %d )</string>
Example output: Count
I need to integer to be displayed between the parentheses, is this not achievable via the strings.xml file? I would rather not use a SpannableString
and keep it simple with the string variable.
I'm using android Context class to get the string
@NonNull
public final String getString(@StringRes int resId, Object... formatArgs) {
return getResources().getString(resId, formatArgs);
}
so... viewObject.text = context.getString(R.string.filter, integerCount)
Solution
Some characters in xml need to be escaped. You can use in your case :
"(" for (
and
")" for )
Answered By - Pylvain
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.