Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Why the 'back' key does nothing on android devices? — Gideros Forum

Why the 'back' key does nothing on android devices?

papirosnikpapirosnik Member
edited September 2012 in Bugs and issues
And why the 'home' key closes my application instead of hiding it?

Suppose, I am in game scene and I want to close my scene and return to level selection. I press back key and now I am in level selection scene. I don't want to play more and I press 'back' key again to go to main menu. When I am in main menu, pressing 'back' key should close my game. This is standard behaviour for android devices.

How can I achieve this with Gideros?

Likes: chipster123

+1 -1 (+1 / -0 )Share on Facebook

Comments

  • Afaik, check your manifest and make sure the following is existed inside activity tab
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize"

    zip
    zip
    AndroidManifest.zip
    766B
  • you should have to put the code to handle back button in gideros there is no concept like activity so most likely on every scene you have to put the code to handle the back button and change the scene on the event of back button and on menu screen call Application:exit() to quit the app

    you can also take a look at keyboard example shipped with installation ( examples --> hardware --> keyboard

    :)
  • @papirosnik, Gideros can't provide proper back button functionality, because all objects and gideros view are in one Activity, thus you can't navigate through activities as in native android apps.
    Thus back button is disabled, so you could imitate it's functionality inside your app by catching event and responding correctly (exiting app or going to previous scene).

    Check keyboard example from Gideros examples

    Dislikes: devex

    +1 -1 (+0 / -1 )Share on Facebook
  • Thanks, all.
    I missed keyboard example.
    It's that i need.
  • Where to find this 'keyboard example'?

    thx
  • amin13aamin13a Member
    local function onKeyDown(event)

    end


    local function onKeyUp(event)

    if event.keyCode == KeyCode.BACK then

    ----- Your function

    end
    end


    stage:addEventListener(Event.KEY_DOWN, onKeyDown)
    stage:addEventListener(Event.KEY_UP, onKeyUp)
Sign In or Register to comment.