Than you all for your responses.
I have managed to do it like the following:
though I'm not sure of which imports are really required by this to work fine.
#if java
import anywheresoftware.b4a.keywords.Common;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.event.ActionEvent;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.BorderPane;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import java.lang.Object;
import java.time.LocalDate;
public void test(DatePicker dp) {
dp.valueProperty().addListener(new ChangeListener<LocalDate>() {
@override
public void changed(ObservableValue<? extends LocalDate> arg0,LocalDate arg1, LocalDate arg2) {
ba.raiseEventFromUI(this, "somefunc", arg2);
}
});
}
#End If