umershaikh
New Member
I know how to create a simple Array in xml like this\[code\]<resources> <string-array name="countries_array"> <item>Afghanistan</item> <item>Albania</item> <item>Algeria</item> <item>American Samoa</item> <item>Andorra</item> <item>Angola</item> <item>Anguilla</item> <item>Antarctica</item> </string-array></resources>\[/code\]And then I initialize it like this in code\[code\]ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, countries_array);textView.setAdapter(adapter);\[/code\]But I want to store more items than just a string, so I need a way to store an arraylist rather than a simple array.Like below\[code\]<resources><Share> <name>Apple</name> <currentRate>5.69</currentRate> <changeToday>-0.11</changeToday> <changeTodayPercent>-0.02</changeTodayPercent> <timeUpdated>2012,12,06,18,00,00</timeUpdated><Share><Share> <name>Microsoft</name> <currentRate>5.88</currentRate> <changeToday>0.19</changeToday> <changeTodayPercent>+0.09</changeTodayPercent> <timeUpdated>2012,12,06,18,00,00</timeUpdated><share>...</resources>\[/code\]I already have a class called Share.java with following variables that need to be set via setMethods public class ShareHolding {\[code\]private String name;private double currentRate;private double changeToday;private double changeTodayPercent;private GregorianCalendar timeUpdated;}\[/code\]and add them to an arraylist\[code\]ArrayList<Share> allShares = new ArrayList<Share>();allShares.getShare(0).setName("I want to access my xml file here and add the first shares name here");\[/code\]