Skip to main content
Inspiring
Mar 24, 2019 1:50 AM UTC
Answered

Soft keyboard not automatically coming up on Galaxy S9 in Android with AIR 31

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

This topic is closed to new replies. Start a new post to keep the conversation going.
Daniel PetkovCorrect answer
Participant
Mar 26, 2019 9:27 AM UTC

I have the same case with devices updated to Android version 9.

10 replies

C-tin
Participant
Feb 15, 2020 11:40 AM UTC

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!

Translate
Participant
Apr 12, 2019 9:05 AM UTC

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:

NativeText.as - Google Drive

Translate
Inspiring
Apr 25, 2019 1:41 AM UTC

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

Translate
Participant
Mar 27, 2019 12:42 PM UTC

I forgot to mention that I initialize only once on application start.

Translate
Inspiring
Apr 7, 2019 5:26 PM UTC

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!

Translate
Inspiring
Apr 8, 2019 2:40 AM UTC

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

Translate
Participant
Mar 26, 2019 10:41 AM UTC

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;

Translate
Inspiring
Mar 26, 2019 6:07 PM UTC

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

Translate
Daniel PetkovCorrect answer
Participant
Mar 26, 2019 9:27 AM UTC

I have the same case with devices updated to Android version 9.

Translate