Change String-Array in Strings.xml to ArrayList

Try this;

List<String> Lines = Arrays.asList(getResources().getStringArray(R.array.Lines));

and this for kotlin:

val Lines = resources.getStringArray(R.array.Lines).toList()

If anybody wondering how to do the same in kotlin

val universities = arrayListOf<String>(*resources.getStringArray(R.array.universities))

universities will be ArrayList<String>


In strings.xml, add string array

<string-array name="dashboard_tags">
    <item>Home</item>
    <item>Settings</item>
</string-array>

In your .java class access the string array like

List<String> tags = Arrays.asList(getResources().getStringArray(R.array.dashboard_tags));