Reputation: 15821
Basically question in the title.
I have seen several examples when people apply formatted
flag to string resource, but can't find any official explanation, what this flag does.
Upvotes: 0
Views: 574
Reputation: 138
There isn't any format documentation on the flag in Android docs, but the flag is commonly used to indicate a string that should be formatted before being shown to the user.
The Android docs show an example of how to do this.
Per the example at the link, you may have a string resource named welcome_messages,
<string name="welcome_messages" formatted="true">Hello, %1$s! You have %2$d new messages.</string>
that allows you to format a welcome message with a custom name and number of messages. You would use this string as follows
String text = getString(R.string.welcome_messages, username, mailCount);
The formatted
flag helps distinguish strings that need to be formatted in this matter before being shown to the user.
Upvotes: 1