I have an ArrayList of a HashMaps, ie Arraylist>, lets call it Array1. Each HashMap has varied data types, mostly strings and ints, such as {“string1″,”stringGoesHere”, “int1”, intGoesHere}
I would like to go through each HashMap in Array1 and add each item to a ListView I have set up with different TextViews of different IDs in an xml file. So I would like to add stringGoesHere into the “string1” ID of the TextView in the ListView, and the int as a string of currency, i.e. intGoesHere=2 so I would like to put $2.00 into the correct ID.
I’m quite unsure of how to do this. Any help would be appreciated. Thanks!
Use a Custom Layout for your listview items. which contains 2 TextViews, 1 each to store the String and int.
Use a Custom adapter to populate your Custom ListView. use the getView() method in the adapter to setText to the respective TextViews using holder.
Follow these tutorials.
http://www.mkyong.com/android/android-listview-example/