I have custom composable InputTextField. I needed to use this field to enter text from Java code. For this I created a helper method in Kotlin:
fun ComposeView.initInputField(
text: String,
onValueChanged: (String) -> Unit,
isEditable: Boolean = true,
) {
setContent {
RncbTheme {
InputTextField(
text = text,
onValueChange = onValueChanged,
isEditable = isEditable,
)
}
}
Here is my java code:
@Override
public void initComposeInputFiled(String initialText) {
InputFieldKt.initInputField(composeInputView, initialText, s -> {
// onValueChange
return Unit.INSTANCE;
});
}
The problem is that I don't quite understand how to manage this field from Java code. Should I call the initComposeInputFiled
method every time if I need to write a specific value to a field ?
And how can you get the current value that is entered into a field from Java code?
Please, help me.