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?
Try using
val focusRequester = remember { FocusRequester() }
modifier = Modifier
.focusRequester(focusRequester = focusRequester)
you can also use
LaunchedEffect(Unit) {
focusRequester.requestFocus()
}
Related
I can't seem to get the soft back and home buttons to show at the bottom of the Android emulator, the way they would display in an actual phone or tablet. I have seen answers to this, but I have applied them (the main one is unchecking "Has Hardware Buttons"):
And they do not work. I think it's because the soft buttons already display on the right-hand side of the emulator, so they don't need to show on the actual emulator screen:
How do I move the soft back and home buttons from the right side of the emulator, to the actual emulator screen?
Go to settings and then search for "system navigation", then select 3 button navigation:
In Android-11, I enabled the Gesture navigation in the Android System Settings and launched a sample application(which contains only one editText on the Screen) using my custom App Launcher. you can see in the below screenshot,
Gesture Navigation means there is no 3-button navigation, similar behavior of iPhones behavior,
You can see in the above image at the keyboard bottom, that there is some additional space available, so in order to remove the space, I used the below code to hide that
WindowInsetsController wcon = getWindow().getInsetsController();
wcon.hide(WindowInsets.Type.navigationBars());
wcon.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
So, after I used the code, I got the expected behavior as below, in this stage everything is working fine, (the additional area is hided)
But,
Once I moved this from recent apps like below and again moved back from the normal stage, the Bottom keyboard area touch is not working, I highlight using the Red Color,
This only happens, when I launched the app using Custom App
What went wrong with this behavior, Why is the bottom area not working?
I'm developing a shortcut settings app that opens some settings (Wifi, Location and Bluetooth). I wish
that when the user go back it's to my application and not the settings app.
To launch the correct setting page I do:
val intent = Intent(Settings.ACTION_BLUETOOTH_SETTINGS)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
startActivity(intent)
On android 8 there is no issue because the top back arrow is not present and the back button returns to my app.
On android 9 for Setting.ACTION_WIFI_SETTINGS and Settings.ACTION_BLUETOOTH_SETTINGS the top back arrow opens the settings main page but the back button goes back to my app.
For Settings.ACTION_LOCATION_SOURCE_SETTINGS both top arrow and back button returns to my app. Which is the behavior I want.
On android 10 both top arrow and back button returns to my app. Which is the behavior I want.
I don't know how to "fix" the inconsistent behavior for Setting.ACTION_WIFI_SETTINGS and Settings.ACTION_BLUETOOTH_SETTINGS on android 9.
I tried this but without success. And also stumbled upon this thread that states that it is the standard behavior but it doesn't seems to be the case since some options behave differently.
EDIT:
Seems to be a manufacturer issue:
The described is seen on an Archos Oxygen 101S
On a Samsung X Cover it always goes back to the settings and not my app
I have opened Android Studio on my second screen, then close it and disconnect the display. Next launch on Android Studio is in the secondary screen even the display is disconnected and isn't able to move on main screen.
I had the same problem. Used the instructions from https://superuser.com/a/98035, ie. "maximized" the Android Studio window, pressed Alt + Spacebar, selected (with keyboard arrows) option "Move" and then pressed right arrow. Window snapped to my cursor and I was able to move it to desired position and maximize on correct screen.
I tried this successfully:
Open Android Studio and be sure is not minimized
Display Settings - Scale and layout
Change from 100% to 125% and back it to 100%
I'm currently developing an Angular App that is meant to run on tablets. I have a fake form composed of different lines with a textfield each. I want that when the user types a value inside one of those fields and hits enter the keyboard closes until he hits again a textfield.
Something like: "touch field -> open keyboard -> insert value -> hit enter -> hide keyboard".
Is this possible or is a built-in behavior of Android and it is not avoidable?
You could try dispatching events manually or turning your field into readonly until it is clicked into/refocused again or something like that.