简体   繁体   中英

draw() method is not being called in GMaps Overlay Method

My draw() method in a custom overlay class that extends LazyMarker from the Google Maps extension library is not being called and I'm not sure why. Here is my method:

@Override
public void draw(Canvas canvas, GoogleMap mapView, boolean shadow)
{
  Log.e("SegmentOverlay2", "Shadow Value:"+shadow);
  super.draw( canvas, mapView, shadow );
  if( !shadow )
  {
     Log.e("SegementOverlay2", "Projection VALUE SEGMENTOVERLAY2: "+mapView.getProjection());
     mProjectionProxy.setProjection( mapView.getProjection() ); 
     draw(canvas);
  }
}

I'm currently using GMaps V2. What is wrong with my code? This this the correct way to do this?

You seem to be mixing Android API v1 and v2. If you had an application that used API v1, you cannot just replace MapView with GoogleMap and think it will work.

The easiest way to migrate is to remove all the code that used API v1 and write it from scratch using these directions: https://developers.google.com/maps/documentation/android/start

Android Maps Extensions has API that extends API from Google Maps Android v2 and will not help you in migration either.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM