1

I'm trying to figure out how to create a listview (preferably with an inner_view so I can display certain information from each map entry in the cells). Does anyone know of some good tutorials out there? I have been really struggling to find complete examples of creating a listview with a map.

jensengar
  • 6,117
  • 17
  • 58
  • 90

1 Answers1

0

What you need to do is extend the BaseAdapter class to make your own custom adapter for handling the LinkedHashMap. Then, you can override the methods relevant to sending data for the ListView to display, as well as adding or removing from the internal LinkedHashMap.

edit: Check out examples for making a custom ArrayAdapter since it is similar to convert that to handling your HashMap implementation.

telkins
  • 10,440
  • 8
  • 52
  • 79
  • How would that look? Sorry, I've done extensive java stuff, but am fairly new to android. So i have `public class MyAdapter extends BaseAdapter` – jensengar Jul 27 '13 at 04:26
  • Would it just make more sense to convert the map to a list? – jensengar Jul 27 '13 at 04:35
  • 1
    @CodesLikeA_Mokey It depends what you are trying to do. A List usually works better with a ListView because it is meant to display items sequentially, whereas a HashMap has no intrinsic ordering. You could convert it on the fly each time to a List if you want to keep using a HashMap though. – telkins Jul 29 '13 at 03:13