I have an Android Jetpack Compose project where I show a screen with a InputField:
- When coming to that screen, the keyboard opens automatically, ready to read the users entered characters.
- The screen also includes a "imprint" link opening default webbrowser
On Android 11 and higher, when I tap the back button (Android hardware button, triangle) the already opened webbrowser disappears and the previous input screen show again and the keyboard again opens automatically.
On Android 10 (emulator and real device), when I tap the back button (Android hardware button, triangle) the already opened webbrowser disappears and the previous input screen show again but the keyboard is not shown on Android 10.
Whats the reason for missing keyboard on Android 10?
CodePudding user response:
Try using
val focusRequester = remember { FocusRequester() }
modifier = Modifier
.focusRequester(focusRequester = focusRequester)
you can also use
LaunchedEffect(Unit) {
focusRequester.requestFocus()
}