The method getBaseContext() is undefined for the type MyMapOverlay in android? why?
i am creating a Geocoder object like.
Geocoder geoCoder = new G开发者_JS百科eocoder(getBaseContext(), Locale.getDefault());
here i got this error in eclipse. i.e.
The method getBaseContext() is undefined for the type MyMapOverlay
getBaseContext() is a default method in android.content.ContextWrapper class.
what is the problem here.. any idea???
The question is: In which class do you create a Geocoder object?
The getBaseContext() does not work in a class which extends from Overlay, because Overlay is not a child of ContextWrapper.
It exists in your MapActivity, if you use one.
The easiest way to solve the issue is to give the Overlay the context as parameter/setter method.
精彩评论