Parameter specified as non-null is null in ArrayAdaper

Please check the sample below:

override fun getDropDownView(position: Int, convertView: View?, parent: ViewGroup): View? {
    return getCustomView(position, convertView, parent)
}

override fun getView(position: Int, convertView: View?, parent: ViewGroup): View? {
    return getCustomView(position, convertView, parent)
}

fun getCustomView(position: Int, convertView: View?, parent: ViewGroup): View? {
    val rootView: View? = LayoutInflater.from(context).inflate(R.layout.my_custom_view, parent, false)
    return rootView
}

The returned value should be nullable.


This issue was caused by incremental compile. Just needed to rebuild project after converting from Java.

Tags:

Android

Kotlin