2

How to define size for any custom component based array like ImageView?

I've tried the following code with a type mismatch error,

    private var dots: Array<ImageView>? = null
    dots = arrayOfNulls<ImageView>(size)

Here's the actual Java code,

private ImageView[] dots;
dots = new ImageView[dotsCount];

1 Answer 1

8

You need to specify that the element type of the array is nullable:

private var dots: Array<ImageView?>? = null
Sign up to request clarification or add additional context in comments.

Comments

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.