JackD JackD - 1 year ago 157
Android Question

Cannot resolve method 'super()' error in android studio

I am getting the error: "Cannot resolve method 'super()'" in my code and I am not sure how to resolve this, do you have any clues?

The code is as follows:

public GeoView( double left, double top, double width )

this.left = left;
this.top = top;
this.width = width;

this.transform = null;
this.backing_store = null;

this.sink = false;

this.last_size = new Rect(0, 0, 200, 200 );
this.do_tracking = false;

Drawable background = new Drawable() {
public void draw(Canvas canvas) {


public void setAlpha(int i) {


public void setColorFilter(ColorFilter colorFilter) {


public int getOpacity() {
return 0;

Answer Source

What is GeoView class? You extended it from another class? If yes. Check that parent class have empty constructor, because you call it.
If it's your own class and it didn't extended from any other class. Then you don't need to call super().

View doesn't have empty constructor. You should Have at list one of this constructor.

    public GeoView(Context context) {

    public GeoView(Context context, AttributeSet attrs) {
        super(context, attrs);

    public GeoView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);

If you want to create view by yourself, you need first constructor. Then you have to

GeoView geoView = new GeoView(YourActivity.this);

Or you can simply ass your view to layout. Then You second will be called constructor. I think you should add all of them.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download