In the HelloMapView tutorial, the map seems to load fine, I can see maps, and also I can see the mark of Mexico that the example gives.
But, when I click on the Mexico mark, my application crashes, with the message
Android application crash
I think that I know what the problem is but I don't know how to solve it:
In step 7, the tutorial says this:
Now set up the ability to handle touch events on the overlay items. First, you're going to need a reference to the application Context as a member of this class. So add Context mContext as a class member, then initialize it with a new class constructor:
public HelloItemizedOverlay(Drawable defaultMarker, Context context) {
super(defaultMarker);
mContext = context;
}
Okay, but in the main tutorial class, when it declares this class, it doesn't give it the context:
HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable);
I tried to do this: new HelloItemizedOverlay(drawable, getApplicationContext());
but that does not work, the map appears without the Mexico mark.
Does anyone have an idea of where I went wrong?