Answers for "Do not concatenate text displayed with setText. Use resource string with placeholders."

0

Do not concatenate text displayed with setText. Use resource string with placeholders.

//in xml
<string name="welcome_messages">Hello, %1$s! You have %2$d new messages.</string>

//using
getString(R.string.welcome_message, "Test", 0);

//the result will be
"Hello Test! you have 0 new messages"
Posted by: Guest on December-12-2021

Code answers related to "Do not concatenate text displayed with setText. Use resource string with placeholders."

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language