Issue
I am following this tutorial here and I am trying to change the ImageView for a MapView but I don't know how to do it, because there it explains passing an array of strings for populating the ImageView.
I tried to do something like this:
Solution
If you don't know how to use Google MapView follow this tutorial.
If you want to know how to pass the data to your child adapter, instead of array of strings construct an array of latitude-longitude pairs as follows:
List<LatLng> locationList = new ArrayList<>();
locationList.add(new LatLng(55.854049, 13.661331));
locationList.add(new LatLng(56.854049, 14.661331));
.
.
.
In your Child.java
class remove int Image
and instead add:
private LatLng location;
public int getLatLng() {
return location;
}
public void setLatLng(LatLng location) {
this.location = location;
}
And in you SetStandardGroups()
method do the needful changes. instead of ch.setImage(Images[j])
add following:
ch.setLatLng(locationList.get(j));
After that if you know how to work with list adapters you should be able to populate the data in you ExpandListAdapter
class.
Answered By - Darush
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.