Can you help me integrating a lib in Android (Java)? I have an issue in setOnRangeListener
from Kotlin to Java.
In Java
custCalendar.setOnRangeSelectedListener(...?);
example Function In Kotlin
calendar_view.setOnRangeSelectedListener { startDate, endDate, startLabel, endLabel ->
departure_date.text = startLabel
return_date.text = endLabel
}
This will be called when the only a single day is selected for both SINGLE and RANGE type
calendar_view.setOnStartSelectedListener { startDate, label ->
departure_date.text = label
return_date.text = "-"
}
fun setOnStartSelectedListener(callback: (startDate: Date, label: String) -> Unit) {
mOnStartSelectedListener = callback
}
fun setOnRangeSelectedListener(callback: (startDate: Date, endDate: Date, startLabel: String, endLabel: String) -> Unit) {
mOnRangeSelectedListener = callback
}
How to implement this function?
Something like this in java, but I cant see the name of your interface so i leave this option :
custCalendar.setOnRangeSelectedListener(new OnRangeSelectedListener() {
@Override
public void onRangeSelected(@NonNull Object1 object, @NonNull Object2 object2) {
}
});
i think you can call it in class java try this code
custCalendar.setOnRangeSelectedListener((startDate,label)->{
// use parameters of function there
return null
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.