Android: String in strings.xml with multiple substitutions


/ Published in: Objective C
Save to your folder(s)

note the odd %1$s syntax. If you only have one substitution, you could just use %s.


Copy this code and paste it in your HTML
  1. // in strings.xml
  2. <string name="cannot_play_video">The video %1$s cannot be played.\n%2$s</string>
  3.  
  4. // to use..
  5. <context>.getString(R.string.cannot_play_video), url, msg )

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.