0
In Android Studio, I’m trying to concatenate a String I saved in an xml file (strings.xml) with a float variable as follows:
gas.setText(String.format("%s %s", R.string.gasoline_mod, value));
The saved string is as follows:
<string name="gasoline_mod">Gasoline: $</string>
However, when testing the application, instead of appearing the saved string in the xml, an 11-digit integer appears, followed by the float variable which, it seems, was correctly invoked. Is there any other way to invoke String or am I missing the syntax?
Brother, I’d like to start by thanking you for your attention. I was able to make the code work, but I had to leave the float as %s because when I put it as %d it crashed. But thank you very much, you saved my life here.
– Thiago Tresca
Hello Thiago. Ok. No problem. Accept the question whether it helped you or vote positive.
– Patrick Santana