This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
built_in:app_events [2014/10/08 14:34] stevegarman created |
built_in:app_events [2015/03/07 10:28] octazid add OnAlarm() |
||
---|---|---|---|
Line 3: | Line 3: | ||
They are | They are | ||
+ | ^Function ^Called when ^ | ||
+ | |OnStart()|application is created | | ||
+ | |OnMenu( name ) |user selects a menu item | | ||
+ | |OnBack() |the back key is pressed but only if it follows app.EnableBackKey( false ); | | ||
+ | |OnPause()|application is paused. (eg. When user switches to home screen)| | ||
+ | |OnResume() |application is resumed. (eg. When user returns from home screen) | | ||
+ | |OnConfig() |configuration changes. (eg. When user rotates phone) | | ||
+ | |OnAlarm() |an alarm previously set by app.SetAlarm() is triggered | | ||
- | //Called when application is created | + | The code of the sample that is bundled with DroidScript |
- | function OnStart() | + | |
- | . | + | |
- | //Called when user selects a menu item. | + | |
- | function OnMenu( name ) | + | |
- | . | + | |
- | //Called when the back key is pressed. | + | |
- | function OnBack() | + | |
- | . | + | |
- | //Called when application is paused. (eg. When user switches to home screen) | + | |
- | function OnPause() | + | |
- | . | + | |
- | //Called when application is resumed. (eg. When user returns from home screen) | + | |
- | function OnResume() | + | |
- | . | + | |
- | //Called when configuration changes. (eg. When user rotates phone) | + | |
- | function OnConfig() | + | |
- | + | ||
- | The code of the sample that is bundled with AndroidScript | + | |
<code javascript appEvents.js> | <code javascript appEvents.js> | ||
//Called when application is created. | //Called when application is created. | ||
Line 30: | Line 20: | ||
app.SetMenu( " | app.SetMenu( " | ||
app.EnableBackKey( false ); | app.EnableBackKey( false ); | ||
- | } | + | |
+ | | ||
+ | | ||
+ | | ||
+ | | ||
//Called when user selects a menu item. | //Called when user selects a menu item. | ||
Line 65: | Line 59: | ||
app.ShowPopup( " | app.ShowPopup( " | ||
} | } | ||
- | </ | + | |
+ | // | ||
+ | // | ||
+ | function OnAlarm( id ) | ||
+ | { | ||
+ | app.ShowPopup( " | ||
+ | } </ |