Handling back button on Android

72 views
Skip to first unread message

Robert Flesch

unread,
Nov 16, 2012, 10:19:40 AM11/16/12
to haxe...@googlegroups.com
I like the idea of the back button in Android, and I wanted to make use of it with in my app.

So I added a function

    function onKeyDown( event:KeyboardEvent ):Void
    {
        if ( BACK_BUTTON == event.keyCode )
            backHandler();
    }

It catches the "Back" key, but then goes on to minimize the app.
I tried calling "event.stopImmediatePropagation();"
but it has no effect. How can I stop this event at the current page with out it propagating?

any one know how to deal with this?


goshki

unread,
Nov 17, 2012, 4:10:49 AM11/17/12
to haxe...@googlegroups.com


 Try onKeyUp instead of onKeyDown.

goshki

unread,
Nov 17, 2012, 4:11:52 AM11/17/12
to haxe...@googlegroups.com


And readd event.stopImmediatePropagation();

Robert Flesch

unread,
Nov 21, 2012, 9:51:44 AM11/21/12
to haxe...@googlegroups.com
Thx goshki

Reply all
Reply to author
Forward
0 new messages