Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a String array with java code from <string-item> list in arrays.xml in Android?

Tags:

android

mobile

I want to get an array of strings reading from arrays.xml file we add in android values/ folder. Could any one kindly give a solution for this. Otherwise I will have to input each these entries in strings.xml and take them to java code using getResources()getString()

Thank you. Tharindu

like image 942
Tharindu Madushanka Avatar asked Oct 28 '09 09:10

Tharindu Madushanka


3 Answers

getResources().getStringArray(R.array.umc_profile_values);

worked 4 me!

like image 118
Piyush Patel Avatar answered Nov 03 '22 12:11

Piyush Patel


Resources res = getResources();
String[] name = res.getStringArray(R.array.name_array);
like image 40
Anil M H Avatar answered Nov 03 '22 12:11

Anil M H


I don't have an IDE in front of me right now, but I think you should be able to do something like R.res.arrays.YOUR_ARRAY_OF_STRINGS.

like image 21
broschb Avatar answered Nov 03 '22 12:11

broschb