OSMdroid - error: no suitable constructor was found for Overlay constructor (without arguments) Overlay.Overlay (Context) is not applicable

Extending the OSMdroid Overlay class in the application

 import org.osmdroid.views.overlay.Overlay; ... public class MapOverlayArea extends Overlay implements TextToSpeech.OnInitListener, OnTouchListener { ... 

I get an error message:

error: no suitable constructor was found for Overlay (without arguments) Overlay.Overlay constructor (Context) is not applicable

+6
source share
1 answer

As indicated by the error message, the required constructor was missing.

 public class MapOverlayArea extends Overlay implements TextToSpeech.OnInitListener, OnTouchListener { public MapOverlayArea(Context ctx) { super(ctx); } //.... } 

Including the constructor as described above and calling it correctly from the main action using

 MapOverlayArea mapOverlayArea = new MapOverlayArea(context); 

solves the problem.

+10
source

All Articles