Skip to main content
Known Participant
November 2, 2015
Question

Hide/dismiss Android soft keyboard?

  • November 2, 2015
  • 5 replies
  • 4200 views

By adding this code to an AIR app's xml you can set it as the "home" or launcher:


<activity android:name=".AppEntry">
  
<intent-filter>
  
<action android:name="android.intent.action.MAIN" />
  
<category android:name="android.intent.category.HOME" />
  
<category android:name="android.intent.category.DEFAULT" />
  
</intent-filter>
</activity>

Unfortunately, this causes the soft keyboard to display on launch, and doesn't go away until the user interacts with the app. Not only does this look strange and unprofessional, but for an unattended application (like digital signage) it's a deal breaker.

I've Googled until my fingers hurt, but I haven't found a solution. Help!

PS. I should note, I tried this, with no luck: stage.focus = null;@@

This topic has been closed for replies.

5 replies

Participant
May 24, 2016

Joe12south​ Did you find a solution to this?

I have the save problem, also for digital signage

Known Participant
May 24, 2016

No, haven't found any way around it, and no response from Adobe.

deesharm
Adobe Employee
Adobe Employee
May 24, 2016

Hi,

Below piece of code can be used to maintain the focus of softkeyboard on Android:

private function mouseEventHandler(event:FocusEvent):void

  {

  if (event.type == FocusEvent.MOUSE_FOCUS_CHANGE)

  {

  event.preventDefault();

  }

Please use the attached sample project at below link:

Dropbox - StageTextFocusEventMouseFocusChange 

Please try this project at your end and share the result.

Below is the link for the fixed bug:

Feature#3797220 - Soft keyboard maintain focus - iOS & Android

Thanks,

Adobe AIR Team

Inspiring
November 9, 2015

unfortunately the SoftKeyboard support for Android is absolute garbage and to me is the best joke of AIR. Everytime I find someone having another softkeyboard issue it is somehow the opposite of every problem i've ever heard.

I posted this bug over 2 years ago....Adobe recognized it and refused to fix it... stating "just convert all your text field to stagetext" as the solution. (which as you know... people who have datagrids of editable text..... thats just the EASIEST solution)

Bug#3627285 - Textfield Bug on GPU with softkeyboard pan

Just this last week I've filled 2 new Android softkeyboard bugs

Bug#4085072 - Android softKeyboardRect Height is Incorrect

Bug#4085068 - Android softKeyboardBehavior "none" has no effect.

still waiting on Adobe to fix, until then chat applications are completely impractical.

Feature#3797220 - Soft keyboard maintain focus

Known Participant
November 3, 2015

Unfortunately, listening for soft keyboard events has no effect. They never fire in this instance. I think this can genuinely be classified as a bug.

Projectitis
Inspiring
November 2, 2015

Oh, just came across this. It might work:

Adobe Flash Platform * Controlling virtual keyboard behavior

"When the keyboard opens, the focused object dispatches the following events in sequence:

softKeyboardActivating event — dispatched immediately before the keyboard begins to rise over the stage. If you call the preventDefault() method of the dispatched event object, the virtual keyboard does not open."

kheftel
Inspiring
November 2, 2015

I've never run across problems with the soft keyboard on either iOS or Android, though I've a.) never created complicated forms and b.) always used a Feathers TextInput control (which I believe wraps StageText).  So I've never used a standard flash TextField for text input on mobile.    

Known Participant
November 2, 2015

This isn't related to any sort of text control. Don't even need text on the stage. Simply add the above to the manifest and it will happen when the app launches.

Projectitis
Inspiring
November 2, 2015

Unfortunate I usually have the opposite problem - trying to get the damn thing to appear on Android!

I haven't tried these, but might be worth a shot:

  • First set 'stage.focus' to a valid object (i.e. textfield) and THEN set it to null - maybe even on the next frame?
  • Set TextField.setSelection to illegal values?
  • Set textField.needsSoftKeyboard=false on a textfuield, and then transfer focus to it (and then away again once it's done its job)?