frank
12/17/2016, 7:32 PMchartViewHolder.container?.setOnClickListener {
onArtistClickListener?.onArtistClick(artists[chartViewHolder.adapterPosition])
}
However when I try to set onArtistClickListener
(a var) in the adapter it just fails. This is the Kotlin interface:
interface OnArtistClickListener {
fun onArtistClick(artistModel: ArtistModel)
}
And this is how I'd expect to be able to set it:
chartAdapter.onArtistClickListener = { Timber.d("Start new controller for $it") }
But it says it found () -> Unit
and requires ChartAdapter.OnArtistClickListener?
.
So this (http://stackoverflow.com/questions/26507099/lambda-expressions-in-kotlin) post seems to explain why this is, but I'm not quite sure what it would actually look like then with () -> Unit
. Any advice?