Android: Use format strings in a strings.xml file


/ Published in: Java
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // in strings.xml..
  2. <string name="my_text">Thanks for playing %s. You scored %d points!</string>
  3.  
  4.  
  5. // and in the java code:
  6. String.format(getString(R.string.my_text), "Bob", 500);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.