Copy link to clipboard
Copied
Hello!
I have recent reports from a few users who have Galaxy S9's with my Android AIR app (SDK 31.0) that the soft keyboard is not showing up when someone clicks in a TextInput field. Another user reports this problem with a Huawei P20 Pro. Does anyone else have trouble with the soft keyboard not launching automatically on Android devices? I don't see the issue in the SDK 32 release. If someone has an S9 or a P20 Pro perhaps you can reach out to me so I can test manually raising the soft keyboard on entry to a TextInput.
Thanks!
-jonathan
I have the same case with devices updated to Android version 9.
Copy link to clipboard
Copied
I have the same case with devices updated to Android version 9.
Copy link to clipboard
Copied
After hours of exploration and experimentation. I was able to find a bypass way to solve this problem (bug maybe). It's not a clean way, but it works. I initialize a StageText class on which I initialize focus and then remove it.
NativeText is my class that implements StageText.
var nativeText:NativeText = new NativeText(true);
nativeText.needsSoftKeyboard = false;
stage.addChild(nativeText);
nativeText.assignFocus();
stage.removeChild(nativeText);
nativeText = null;
Copy link to clipboard
Copied
Thank you Daniel for your speedy work in finding this solution/workaround. I will try it later this week and post here my results. I was thinking I was going to have to raise the soft keyboard through a method call on TextInput, but I assume that is already what the TextField is trying to do so I was not hopeful it would be a good solution.
-jonathan
Copy link to clipboard
Copied
I forgot to mention that I initialize only once on application start.
Copy link to clipboard
Copied
Hi Daniel, I am trying this now. I am curious as to what methods/properties you have in your NativeText class, and why you pass true to the constructor. In the meantime, I assumed NativeText() is a Sprite with one method, assignFocus(). I will let you know what I find, thanks again!
Copy link to clipboard
Copied
Hi Daniel, I was able to raise the keyboard with StageText (thanks!) but I can't control the keyboard properly, so I was curious about your workaround.
Did you put your code at the place where there is a TextInput, so it raises the keyboard, or did you put it on some other screen before a TextInput is on the screen? I can raise the keyboard on a screen without a TextInput but that looks silly. If I use the code on a screen with a TextInput, the user has to click to the TextInput to have the keyboard type in there. I can't seem to focus on the TextInput when the keyboard first comes up, I assume the keyboard is focused still on the NativeText.
I would really appreciate it if you shared your NativeText class code, because when I simply wrapped a StageText in a Sprite, the keyboard would not appear. I had to set the viewport for the StageText once the NativeText.stage property was non-null, which I believe I did in a messy way.
Thanks!
-jonathan
Copy link to clipboard
Copied
Hi,
When I use this code:
var nativeText:NativeText = new NativeText(true);
nativeText.needsSoftKeyboard = false;
stage.addChild(nativeText);
nativeText.assignFocus();
stage.removeChild(nativeText);
nativeText = null;
I not have visual elements yet, I use the code at the beginning of the application initialization. And actually users not see keyboard rising. After that, when I add TextField it works OK.
You can see the NativeText class here:
Copy link to clipboard
Copied
Hi Daniel, that works great, thank you very much!
The only problem I see is that when I first side-load the app and launch it, the keyboard does not come up. When I close the app and re-open, then into the future, the keyboard does work. I may have to make a hack to raise the keyboard the first time a text field appears after the app is installed.
Thank you very much for your correct and prompt help!
-jonathan
Copy link to clipboard
Copied
Hi Daniel,
Would you kindly share your NativeText.as file again?
Thank you in advance. Thank you for your contribution,
JP
Copy link to clipboard
Copied
I had the same issue in an AIR 32.0.0.116 app built for Android
The NativeText.as can be found here: https://raw.githubusercontent.com/cantrell/StageTextExample/master/src/NativeText.as
The difference in code would be that you don't pass true when you create the NativeText instance:
var nativeText:NativeText = new NativeText();
// instead of
// var nativeText:NativeText = new NativeText(true);
Take care and good luck!