1

hi im wanting to know how to add google maps into a list view? i have tried it by adding into my list but i get an error that says it needs to be in a MapsActivity but my Activity already extends ListActivity is there a way i can extend multiple activities? or does anyone know how to implement google maps within a list view?

Luke Batley
  • 2,384
  • 10
  • 44
  • 76
  • Why do you want to add a map to a list view in the first place? Are you sure you really need that? How many maps will want to have? – Nuno Gonçalves Jun 24 '12 at 11:26

1 Answers1

2

Java doesn't allow multi inheritance. Therefor if you need a MapActivity you can't extend the ListActivity as weel. So you want to have a listView defined on the XML.

Add a list view to your xml file:

<ListView android:id="+@id/myListView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content">
</ListView>

And then reference it on the activity to make your logic:

 Listview lv = (ListView) findviewById(R.id.myListView);
    lv...........
Nuno Gonçalves
  • 6,202
  • 7
  • 46
  • 66