0

I am extending ArrayAdapter:

public class ImgItemAdapter extends ArrayAdapter<ImageData>

I am trying to implement its constructor:

public ImgItemAdapter(Context context, int textViewResourceId, String[] imageArray) {
        super(context, textViewResourceId, imageArray);

        inflator = ((Activity)context).getLayoutInflater();
        imgUrlArray = imageArray;
    }

Problem is - when I am trying to compile it is giving me this error message:

Error:(28, 9) cannot find symbol constructor ArrayAdapter(android.content.Context,int,java.lang.String[])

Any ideas?

Here is my source code: Sample Code

1 Answer 1

1

You are calling super(context, textViewResourceId, imageArray); and you received that error meaning that such constructor with the provided parameters does not exist in the super class which is ArrayAdapter. Also check the docs to see the correct arguments of the constructors.

Sign up to request clarification or add additional context in comments.

3 Comments

An array adapter does support the above mentioned parameters in it's constructor.
No, look at his parameterized type. It is ImageData but he is passing a String[] as the last argument, it should have been ImageData[]
Yep! But it's probable that OP does not know this :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.