How to iterate Arraylist <HashMap <String, String >>?
I have an ArrayList object, for example:
ArrayList<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>(); How to iterate over a list? I want to show a value in a TextView that comes from the data of an ArrayList object.
+7
Piyush
source share2 answers
The simplest is to HashMap over all the HashMap in an ArrayList , and then iterate over all the keys in the Map :
TextView view = (TextView) view.findViewById(R.id.view); for (HashMap<String, String> map : data) for (Entry<String, String> entry : map.entrySet()) view.append(entry.getKey() + " => " + entry.getValue()); +23
dacwe
source share