How can I access a static java variable in a resource in strings.xml in the android studio?
I have a variable like this:
public static final String NUM_OF_DAYS = "10";
Now,
I want to use this somehow in strings.xml in a resource.
EDIT:
I just want to use the string.xml resource (which will access NUM_OF_DAYS) in a java file.
You can use your variable like this
public static final String NUM_OF_DAYS = "10";
string.xml
<string name="days">No of days: %s</string>
Java class
YOUR_VIEW.settext(getString(R.string.days, NUM_OF_DAYS));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With