exiting an application gracefully

Hi there..

I want my application to have a dialog box that pops up if the 'back' button is pressed... how do I capture the back button event? Because at the moment as soon as the user presses the back button, my application closes down...

Thanks

there was a topic about back button api, search it on forums

Hi,
Something like :

1
2
3
4
5
6
7
8
9
10
11
12
13
14
  -- Key listener
  local function onKeyEvent( event )
          local phase = event.phase
          local keyName = event.keyName
          if ( keyName == "back") then 
              onQuitButton() -- where you pop-up the dialog
              return true
          else
              return false
          end
  end
 
      -- Add the key callback
      Runtime:addEventListener( "key", onKeyEvent )

Thanks for pointing the way Phil, much appreciated

views:1300 update:2011/10/17 8:58:49
corona forums © 2003-2011