I have the following code containing two layers with markers, when trying to implement a transition through the LayerManager the class is missing
// Create a list to hold your markers
ArrayList<OverlayItem> items = new ArrayList<>();
// Add some markers to the list
items.add(new OverlayItem("marker1 ", "sth " +"sth2", new GeoPoint(54.73808331990483, 55.97157451178393)));
items.add(new OverlayItem("Marker 2", "This is the second marker", new GeoPoint(54.71323629153077, 55.993348227111085)));
items.add(new OverlayItem("Marker 3", "This is the third marker", new GeoPoint(54.728460008222974, 55.946710455967626)));
// Create an ItemizedOverlayWithFocus to manage and display your markers
ItemizedOverlayWithFocus overlay;
overlay = new ItemizedOverlayWithFocus<>(this, items, new ItemizedIconOverlay.OnItemGestureListener<>() @Override
public boolean onItemSingleTapUp(int index, OverlayItem item) {
// Assuming the OverlayItem object has been created and added to an ArrayList<OverlayItem> items
String title = item.getTitle();
int duration = Toast.LENGTH_SHORT;
Toast.makeText(getApplicationContext(), title, duration).show();
return true;}
@Override
public boolean onItemLongPress(int index, OverlayItem item) {
String snippet = item.getSnippet();
int duration = Toast.LENGTH_SHORT;
Toast.makeText(getApplicationContext(), snippet, duration).show();
return true;}}
);
// Add the overlay to your map controller
mapView.getOverlayManager().add(overlay);
ArrayList<OverlayItem> concert = new ArrayList<>();
// Add some markers to the list
concert.add(new OverlayItem("concert 1", "This is the first marker", new GeoPoint(54.72568197320434, 55.9441373824082)));
concert.add(new OverlayItem("concert 2", "This is the second marker", new GeoPoint(54.72515454700825, 56.0299419042602)));
concert.add(new OverlayItem("concert 3", "This is the third marker", new GeoPoint(54.77245098808131, 56.05960561313011)));
// Create an ItemizedOverlayWithFocus to manage and display your markers
ItemizedOverlayWithFocus overlays;
overlays = new ItemizedOverlayWithFocus<>(this, context concert,new ItemizedIconOverlay.OnItemGestureListener<>() {
@Override
public boolean onItemSingleTapUp(int index, OverlayItem item) {
// Assuming the OverlayItem object has been created and added to an ArrayList<OverlayItem> items
String title = item.getTitle();
int duration = Toast.LENGTH_SHORT;
Toast.makeText(getApplicationContext(), title, duration).show();
return true;}
@Override
public boolean onItemLongPress(int index, OverlayItem item) {
String snippet = item.getSnippet();
int duration = Toast.LENGTH_SHORT;
Toast.makeText(getApplicationContext(), snippet, duration).show();
return true;}}
);
// Add the overlay to your map controller
mapView.getOverlayManager().add(overlays);
used mapView.getOverlayManager().add(layer2Overlay); also tried to use LayerManager layerManager = new LayerManager() but got error "Cannot resolve method 'add' in 'LayerManager'"