Skip to main content
Participant
April 6, 2012
Question

Keyboard and andorid back button

  • April 6, 2012
  • 1 reply
  • 988 views

I've discovered one bad issue in app with multiple views.

Way to reproduce:

1) Activate keyboard at the second view in textInput.

2) Press back. (Keyboard will disapper.)

3) Press back. App will exit, but it' will not return to the previous view, as it should be.

I've tested it on Galaxy Nexus and Xperia Ray and Air 3.1/3,2.

Here is likely the same problem. Sample fxp: http://francisaltomare.com/_etc/TestBackKey.fxp

This topic has been closed for replies.

1 reply

Known Participant
April 6, 2012

Seems like it's a Flex framework bug rather then AIR. And Flex has moved to Apache foundation, you can submit bug report here https://issues.apache.org/jira/browse/FLEX

GEG_manAuthor
Participant
April 7, 2012

May be you are right. I've briefly reviewed flex source and I can't say if it is a flex problem or the problem in air and flex interaction, but in pure AS project there is no such issue. But this issue happens in simple flex mobile project.

This code works great in pure AS3:

stage.addEventListener(KeyboardEvent.KEY_DOWN,keyboardHandler,false);

protected function keyboardHandler(event:KeyboardEvent):void

{

     if (event.keyCode == Keyboard.BACK)

      event.preventDefault();

}

In Flex project based on Application it does not work at all. I've tried to set listener to stage, systemManager.stage and "this" in Application. In Flex sources I can find logic dependent from Keyboard.BACK only in ViewNavigatorApplicationBase.

Known Participant
April 7, 2012

How about NativeApplication.nativeApplication.addEventListener(KeyboardEvent.KEY_DOWN, keyboardHandler, false, int.MAX_VALUE); ?