I'm beginner in Kotlin for Android. I have some stupid questions which i can't find answers.
First question. For Example i have a code like this
class myAdapter(context: Context, val list: List<DataSource>)
: ArrayAdapter<DataSource>(context, 0, list){
If i write like that (without arguments)
class myAdapter(context: Context, val list: List<DataSource>)
: ArrayAdapter<DataSource>(){
then intellij give me out this error: None of the following functions can be called with the arguments supplied. Why should i to provide arguments to ArrayAdapter and what are they affected?
Second question. For example, i have a code:
override fun getView(position: Int, convertView: View?, parent: ViewGroup): View {
val lf: LayoutInflater = LayoutInflater.from(context)
val row = lf.inflate(R.layout.custom_list_view, parent, false)
val view_icon = row.findViewById<ImageView>(R.id.icon)
val view_title = row.findViewById<TextView>(R.id.title)
val view_subtitle = row.findViewById<TextView>(R.id.subtitle)
val ds: DataSource = list[position]
view_icon.setImageResource(R.drawable.ic_folder_black_24dp)
view_title.text = ds.ds_title
view_subtitle.text = ds.ds_subtitle
return row
}
What's means the "row" variable and why should i to assign "inflate" to it? How explain it with words? If i don't assign, then inflate will not work. And what's means this:
list[position]
Where can i read about it? Kotlin just break down my mind.