Is there a way to simulate a back button press in simulator?

Like the title says is there anyway to simulate an android back button press in the simulator?

No, the only way is to simulate it by placing a button on the screen if you detect you are running in the simulator.

No, the only way is to simulate it by placing a button on the screen if you detect you are running in the simulator.

This can be a really difficult solution to implement with popups that are blocking, overlays,  etc.  Certainly would help the cause a great deal to have a back button on the android simulators that sends the app the appropriate event so we can get the back key right without having to go all the way to the device to test things out.

IMO this is the source of lots of headaches for Android app developers using Corona.

This can be a really difficult solution to implement with popups that are blocking, overlays,  etc.  Certainly would help the cause a great deal to have a back button on the android simulators that sends the app the appropriate event so we can get the back key right without having to go all the way to the device to test things out.

IMO this is the source of lots of headaches for Android app developers using Corona.

I’d like to +1 this. It would be very convenient to be able to test this feature in the simulator.

My solution was to assign the B button on my keyboard as the back button in the key listener:

[lua]

local function onKeyEvent(event)

    local phase = event.phase

    local keyName = event.keyName

   

    – Listening for B as well so can test Android Back with B key

    if (“back” == keyName and phase == “down”) or (“b” == keyName and phase == “down” and system.getInfo(“environment”) == “simulator”)  then

        print(“Back”)

    end

end

Runtime:addEventListener( “key”, onKeyEvent )       

[/lua]

Good solution. Helped me as well. Thanks!

I’d like to +1 this. It would be very convenient to be able to test this feature in the simulator.

My solution was to assign the B button on my keyboard as the back button in the key listener:

[lua]

local function onKeyEvent(event)

    local phase = event.phase

    local keyName = event.keyName

   

    – Listening for B as well so can test Android Back with B key

    if (“back” == keyName and phase == “down”) or (“b” == keyName and phase == “down” and system.getInfo(“environment”) == “simulator”)  then

        print(“Back”)

    end

end

Runtime:addEventListener( “key”, onKeyEvent )       

[/lua]

Good solution. Helped me as well. Thanks!

nice solution @jonjonsson

nice solution @jonjonsson