Use string format arguments in Android layout xml file [duplicate]

Use string format arguments in Android layout xml file [duplicate]

This question already has an answer here:

How do I use databinding to combine a string from resources with a dynamic variable in XML?

5 answers

I have a string defined in my String.xml file that uses format arguments, i.e.:
Hello %1$s.

Is there a way to assign a value to the format argument in a layout xml file? I have something like:

I know I can do it in java, but is there a way to do it here?
Thanks!

Solutions/Answers:

Solution 1:

No, there is no means of applying a value to the format from a layout file — only in Java. Sorry!

UPDATE: You can now use data binding for this — see the duplicate question.

Solution 2:

For Example
In strings.xml
You have %d unread messages

In Your Java code
String message = getString(R.string.unread_messages, 10);

References

Related:  Android Bitmap to Base64 String