in arrays.xml
<string-array name="my_items">
<item>My item 1</item>
<item>My item 2</item>
<item>My item 3</item>
</string-array>
in strings.xml
<resources>
<string name="item1">My item 1</string>
<string name="item2">My item 2</string>
<string name="item3">My item 3</string>
</resources>
I would like to reference the string in the array "My item 1" from strings.xml. How do I do that?
XML file saved at res/values/strings.
android-navigation/app/src/main/res/values/strings. xml.
String. xml file contains all the strings which will be used frequently in Android project. String. xml file present in the values folder which is sub folder of res folder in project structure.In Android Studio, we have many Views such as TextView,Button,EditText,CheckBox,RadioButton etc.
It is one of the most used data structure by programmers due to its efficient and productive nature; The Array is a collection of similar data type elements. It uses a contiguous memory location to store the elements. A String Array is an Array of a fixed number of String values. A String is a sequence of characters.
oh yeah, that is what I meant. This is how I did it.
<string-array name="my_items">
<item>@string/item1</item>
<item>@string/item2</item>
<item>@string/item3</item>
</string-array>
It resolved correctly in Android 1.6
You can't. It might be possible to do the reverse: have @string/item1
in the <string-array>
.
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