-2

Possible Duplicate:
How to put variable inside string-resources?

string.xml file give error in the following lines.

Error :Multiple annotations found at this line: - error: Multiple substitutions specified in non-positional format; did you mean to add the formatted="false" attribute? - error: Found tag where is expected

 <!-- Search failure message. -->
<string name="no_results">No results found for \"%s\"</string>
Community
  • 1
  • 1
TUSWAY
  • 27
  • 4
  • 1
    [This](http://stackoverflow.com/a/12605846/645270) might help. About using the `%` symbol – keyser Feb 03 '13 at 19:36

1 Answers1

1

If you need to format your strings using String.format(String, Object...), then you have to put your format arguments in the string resource in the correct way. Replace your string with the following:

<string name="no_results">No results found for %1$s</string>

-

Resources res = getResources();
String text = String.format(res.getString(R.string.no_results), "your text");
StarsSky
  • 6,721
  • 6
  • 38
  • 63