Mostly I found like this on Internet
public static final String[] imageurl = new String[] {
"http://sample.com/sample1.png",
"http://sample.com/sample1.png"
};
So when loading image we just need to call
imageloader.displayImage(imageurl[position], imageView, options);
MY QUESTION
I have string array inside arrays.xml
<string-array name="sample" >
<item>image1</item>
<item>image2</item>
<item>image3</item>
<item>image4</item>
</string-array>
Then I'm trying to read sample string array inside arrays.xml
....
ArrayList<Integer> list = new ArrayList<Integer>();
....
final Resources resources = getResources();
final String packageName = getApplication().getPackageName();
final String[] extras = resources.getStringArray(R.array.sample);
for (String extra : extras) {
int res = resources.getIdentifier(extra, "drawable", packageName);
if (res != 0) {
list.add(res);
}
}
HOW TO LOAD IMAGES FROM ARRAYLIST?
It's like
imageloader.displayImage(list.get(position), imageView, options);
OR
HOW TO SET STRING[] FROM STRING ARRAY INSIDE ARRAYS.XML?
I don't want to set it manually like this
public static final String[] imageurl = new String[] {
"drawable://" R.drawable.image1
"drawable://" R.drawable.image2
...
};