I am a noob in mobile app development.
Scenario
Within Dialog, within Column, I have a text field and a Button. (Button belongs to material3. For the text field, I have tried various ones available under android.widget as well as androidx.compose.material3)
The Composable function containing the Dialog is invoked from another Composable using navController.navigate. The button, on click, makes an API call via ViewModel via Repository and then invokes navController.popBackStack().
Problem
When the IME keyboard is open for the text field, if I click on the button, then I get the error.
Ime callback not found. Ignoring unregisterReceivedCallback. callbackId: 77948589
When the keyboard is not open, if I click on the button, then there's no error.
What I have tried
Have tried multiple things, including focusManager.clearFocus() at the beginning of the button click, specifying imeAction = ImeAction.None as part of text field's keyboardOptions.
The problem is similar to that mentioned in Android Ime callback not found issue on AlertDialog dismiss, but that doesn't contain any solution.
Details about the App.
Late answer, but Google got me here so if anyone else has an issue:
I found this article. Basically, the ime options need to be set. I also needed to clean the project (as always!) and now the error's gone. My code is:
OutlinedTextField(
value = authKey,
onValueChange = {
// ....
},
keyboardActions = KeyboardActions(
onNext = {
keyboardController?.hide()
},
onSend = {
keyboardController?.hide()
},
onDone = {
keyboardController?.hide()
}
),
keyboardOptions = KeyboardOptions(
imeAction = ImeAction.Done
),
label = { Text("authorisation phrase.." },
modifier = Modifier.fillMaxWidth(1.0f),
colors = OutlinedTextFieldDefaults.colors(
focusedContainerColor = Color.Transparent,
unfocusedContainerColor = Color.Transparent,
unfocusedTextColor =Color.hsv(hue = 0.0f, saturation = 0.0f, value = 0.9f),
focusedTextColor = Color.White,
unfocusedLabelColor = Color.hsv(hue = 0.0f, saturation = 0.0f, value = 0.9f),
focusedLabelColor = Color.White,
focusedBorderColor = Color.White,
unfocusedBorderColor = Color.White
)
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With