Format a string resource

suggest change

String resources can take format arguments and fill them at runtime:

  1. Edit strings.xml.
<string name="my_string">This is %1$s</string>
  1. Format the string.
String fun = "fun";
String formatted = context.getString(R.string.my_string, fun);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents