Pergunta

Since the last two weeks i am developing a Navigation App. I want to set an Pointer that is showing me the current Location. How I can make this without using the Marker ? Or did I have to use the Marker ?

Foi útil?

Solução 2

Marker startMarker = new Marker(mapView);
        startMarker.setPosition(gp);
        startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_BOTTOM);
        mapView.getOverlays().add(startMarker);
        mapView.invalidate();
        startMarker.setIcon(getResources().getDrawable(R.drawable.iconcurrentlocation));
        startMarker.setTitle("Start point");

with this one u can set immag on yout cuurentLocation and the Important thing is that you have to import this

import org.osmdroid.bonuspack.overlays.Marker;

I hope this helps somebody

Outras dicas

If you want to display the current location, you can use one of the following osmdroid Overlays:

  • MyLocationOverlay or MyLocationNewOverlay: handling GPS positionning

  • Or DirectedLocationOverlay: GPS position/direction/precision to handle yourself.

By the way, Marker(MapView) should be defined... Your OSMBonusPack lib is probably not installed properly.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top