Table of Contents

EnableBackKey

(Information and examples taken from the DroidScript documentation)

Description

The EnableBackKey enables or disables the standard behaviour of the back key in your app. If you disable it, then your app will not close when the back key is pressed.

When the back button is pressed, the OnBack callback function is called (if it exists). This allows you to change the behaviour of this button.

 app.EnableBackKey( enable );

Example

function OnStart()
{
  app.EnableBackKey( false );
}
 
function OnBack()
{
  var yesNo = app.CreateYesNoDialog( "Exit App?" );
  yesNo.SetOnTouch( yesNo_OnTouch );
}
 
function yesNo_OnTouch( result )
{
  if( result=="Yes" ) app.Exit();
}