6

While extending OSMdroid Overlay class in an application

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

...

I receive an error:

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

Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208
tony gil
  • 9,424
  • 6
  • 76
  • 100

1 Answers1

10

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 above, and calling it correctly from main activity using

MapOverlayArea mapOverlayArea = new MapOverlayArea(context);

solves the problem.

albciff
  • 18,112
  • 4
  • 64
  • 89
Shadow The GPT Wizard
  • 66,030
  • 26
  • 140
  • 208
  • 4
    This post was discussed on meta http://meta.stackoverflow.com/questions/323404/what-to-do-when-asker-offers-free-rep-points – Travis J May 19 '16 at 20:53