I am converting a Java file into Kotlin in Android Studio and I am getting this error:
No value passed for parameter 'init'
I modified the code slightly by adding lateinit
The java code is:
private TextView[] dots;
private int[] layouts;
private void addBottomDots(int currentPage)
{
dots = new TextView[layouts.length];
//some lines here
}
And corresponding Kotlin code is
private lateinit var dots: Array<TextView>
private lateinit var layouts: IntArray
private fun addBottomDots(currentPage: Int)
{
dots = Array<TextView>(layouts.size) // error happens here
// some lines here
}
As I am new in Kotlin, I can't figure out why this is the reason