For those of you who got to the google maps tutorial, here are a few fixes of the issues you found:
Since we've defined a constructor that takes a context as a parameter
(HelloItemizedOverlay(Drawable defaultMarker, Context context)
it would be a shame not to use it, right? They probably intended to call it but forgot to update the code. So replaceHelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable);
in the HelloGoogleMapsActivity file inside the onCreate method with thisHelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable,this);
For the next problem, which is not seeing your icon after you made this changes, make sure you redefine your constructor like this replace
public HelloItemizedOverlay(Drawable defaultMarker, Context context) {
super(defaultMarker);
mContext = context;
}
with this
public HelloItemizedOverlay(Drawable defaultMarker, Context context) {
super(boundCenterBottom(defaultMarker));
mContext = context;
}
No comments:
Post a Comment