Format a string resource
suggest changeString resources can take format arguments and fill them at runtime:
- Edit
strings.xml.
<string name="my_string">This is %1$s</string>
- Format the string.
String fun = "fun";
String formatted = context.getString(R.string.my_string, fun);
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents