0

I am trying to place 2 images on 2 different gps locations. The images are not showing up on the map. What am I doing wrong.

for (int i = 0; i < subscribedToJourneys.size(); i++) {
        IJourneyDetails journey = subscribedToJourneys.get(i) ;
        Double lat = journey.getSourceGPSX() ;
        Double lng = journey.getSourceGPSY() ;

        Drawable marker = getResources().getDrawable(R.drawable.pushpin);
        marker.setBounds(0, 0, marker.getIntrinsicWidth(),
                marker.getIntrinsicHeight());
        locationMarker = new LocationMarker(this, subscribedToMap, marker,
                (ImageView) findViewById(R.id.drag));
        subscribedToMap.getOverlays().add(locationMarker);
        locationOverlay = new MyLocationOverlay(this, subscribedToMap);
        subscribedToMap.getOverlays().add(locationOverlay);

        lat = journey.getDestinationGPSX() ;
        lng = journey.getDestinationGPSY() ;
        marker.setBounds(0, 0, marker.getIntrinsicWidth(),
                marker.getIntrinsicHeight());
        locationMarker = new LocationMarker(this, subscribedToMap, marker,
                (ImageView) findViewById(R.id.drag));
        subscribedToMap.getOverlays().add(locationMarker);
        locationOverlay = new MyLocationOverlay(this, subscribedToMap);
        subscribedToMap.getOverlays().add(locationOverlay);
    }

public class LocationMarker extends ItemizedOverlay<OverlayItem> {
......
@Override
    public void draw(Canvas canvas, MapView mapView, boolean shadow) {
        super.draw(canvas, mapView, shadow);
        boundCenterBottom(marker);
    }
 ....
 }

Edit : I tried the below and it worked. from here

final Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(
        "http://maps.google.com/maps?" +                "saddr="+YOUR_START_LONGITUDE+","+YOUR_START_LATITUDE+"&daddr="YOUR_END_LONGITUDE+","+YOUR_END_LATITUDE));
     intent.setClassName(
      "com.google.android.apps.maps",
      "com.google.android.maps.MapsActivity");

startActivity(intent);

I now need every route to have a different color. All blue makes it difficult to understand.

Community
  • 1
  • 1
Siddharth
  • 9,349
  • 16
  • 86
  • 148

0 Answers0