Hi want to get the arraylist from the resources.xml is there any code for this.please give me some suggestions.Thanks in advance
You can do this as follows but have to give up on generics for the list container. List<List> listOfMixedTypes = new ArrayList<List>(); ArrayList<String> listOfStrings = new ArrayList<String>(); ArrayList<Integer> listOfIntegers = new ArrayList<Integer>(); listOfMixedTypes. add(listOfStrings); listOfMixedTypes.
Use Arrays.asList :
String[] myResArray = getResources().getStringArray(R.array.my_array); List<String> myResArrayList = Arrays.asList(myResArray);
This list will be immutable, so if you want a mutable list, just do :
List<String> myResMutableList = new ArrayList<String>(myResArrayList);
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