public interface CoronaRuntimeListener
CoronaRuntime
to detect when it is loaded, started, suspended, etc.
Instances of this interface are to be given to the
CoronaEnvironment.addRuntimeListener()
method. If you want to receive the runtime's
"loaded" and "started" events,
then you should assign the listener before displaying the CoronaActivity
,
such as in a derived version of
Android's Application class.
WARNING! All methods in this interface are not called on the main UI thread.
The CoronaRuntime
and its Lua scripts run on a separate thread.
This means that you should not manipulate an
activity's UI elements from these methods.
CoronaEnvironment
,
CoronaRuntime
Modifier and Type | Method and Description |
---|---|
void |
onExiting(CoronaRuntime runtime)
Called just before the
CoronaRuntime terminates. |
void |
onLoaded(CoronaRuntime runtime)
Called after the
CoronaRuntime
has been created and just before executing the "main.lua" file. |
void |
onResumed(CoronaRuntime runtime)
Called just after the
CoronaRuntime has been resumed after a suspend. |
void |
onStarted(CoronaRuntime runtime)
Called just after the
CoronaRuntime has executed the "main.lua" file. |
void |
onSuspended(CoronaRuntime runtime)
Called just after the
CoronaRuntime has been suspended
which pauses all rendering, audio, timers, and other Corona related operations. |
void onLoaded(CoronaRuntime runtime)
CoronaRuntime
has been created and just before executing the "main.lua" file.
This is the application's opportunity to register custom APIs into Lua.
WARNING! This method is not called on the main UI thread.
runtime
- Reference to the CoronaRuntime
object that has just been loaded/initialized.
Provides a LuaState
object that allows the application to extend the Lua API.void onStarted(CoronaRuntime runtime)
CoronaRuntime
has executed the "main.lua" file.
WARNING! This method is not called on the main UI thread.
runtime
- Reference to the CoronaRuntime
object that has just been started.void onSuspended(CoronaRuntime runtime)
CoronaRuntime
has been suspended
which pauses all rendering, audio, timers, and other Corona related operations. This can happen when another
Android activity (ie: window) has
been displayed, when the screen has been powered off, or when the screen lock is shown.
WARNING! This method is not called on the main UI thread.
runtime
- Reference to the CoronaRuntime
object that has just been suspended.void onResumed(CoronaRuntime runtime)
CoronaRuntime
has been resumed after a suspend.
WARNING! This method is not called on the main UI thread.
runtime
- Reference to the CoronaRuntime
object that has just been resumed.void onExiting(CoronaRuntime runtime)
CoronaRuntime
terminates.
This happens when the CoronaActivity
is being destroyed which happens
when the user presses the Back button on the
activity, when the
native.requestExit() method is called in Lua,
or when the activity's finish()
method is called. This does not mean that the application is exiting.
WARNING! This method is not called on the main UI thread.
runtime
- Reference to the CoronaRuntime
object that is being terminated.