I have a problem about getting a value from my ArrayList<HashMap<String, String>>
.
My code is:
ArrayList<HashMap<String, String>> myArrayList;
and then:
HashMap<String, String> map = new HashMap<String, String>();
map.put(TAG_ID, id);
map.put(TAG_NAME, name);
myArrayList.add(map);
If I want to get the name, for example, I tried as follow but I obtain a runtime error (the application crashes):
System.out.println(myArrayList.get(1).get(TAG_NAME));
How can I solve it?
Thank you very much!