Consuming a Kotlin Function with an Argument in a Java file using the correct syntax
I have a variable called onItemSelected in a Kotlin file
var onItemSelected: ((String) -> Void)? = null
In a Java file I am trying to set that variable, but am unable to figure out the correct syntax.
The lambda expression keeps wanting to return a Void, however, when I return a void, then it doesn't compile.
binding.myCustomView.getOnItemSelected() = (item, Void) -> {
//What should happen here?
Log.i("Test", item);
return;
};
I have tried various syntax,...