:::: MENU ::::

Android: Load array of Strings from Resources

It is remanded to keep your strings in xml resources, but how do you get them as a String[] ?

Save as a xml file on your project > res > values > mydata.xml

<?xml version="1.0" encoding="utf-8"?>
    <string-array name="blogs">

and from your source code

Resources res = this.getResources();
String[] myWebsitesArray= res.getStringArray(R.array.websites);

that is it.

Comments are closed.