android :: Activity :: defaultinit
# An Android activity
#
# You must implement the callbacks (prefixed with `on_`) to follow the
# standard Android life-cycle.
class Activity
# Native Java activity
var native: NativeActivity
# Notification from Android, the activity is created
#
# Do your normal static set up here.
#
# If available, `save_state` contains the activity's previous state
# as registered by `on_save_instance_state`.
#
# Followed by `on_start`.
fun on_create(save_state: NativeBundle)
do
app.on_create
app.on_restore_state
end
# Notification from Android, the activity has been restarted
#
# Followed by `on_start`.
fun on_restart do app.on_restart
# Notification from Android, the activity has been started
#
# Followed by `on_resume` or `on_stop`.
fun on_start do app.on_start
# Notification from Android, the activity has been resumed
#
# Followed by `on_pause`
fun on_resume do app.on_resume
# Notification from Android, the activity has been paused
#
# Followed by `on_resume` or `on_stop`.
fun on_pause do app.on_pause
# Notification from Android, the activity has been stopped
#
# Followed by `on_restart` or `on_destroy`.
fun on_stop do app.on_stop
# Notification from Android, the activity is being destroyed
#
# Clean up and exit.
fun on_destroy
do
app.on_destroy
native.delete_global_ref
app.activities.remove self
end
# Notification from Android, the activity is being re-initialized from a `save_state`
#
# Occurs after `on_start`.
fun on_restore_instance_state(save_state: NativeBundle) do end
# Notification from Android, the activity may be stopped, save state
#
# Occurs before `on_stop` and, without guarantee, before or after `on_pause`.
fun on_save_instance_state(save_state: NativeBundle) do app.on_save_state
# Notification from Android, the system is running low on memory
#
# Try to reduce your memory use.
fun on_low_memory do force_garbage_collection
# Notification from Android, the current window of the activity has lost or gained focus
fun on_window_focus_changed(has_focus: Bool) do end
# Notification from Android, the current device configuration has changed
fun on_configuration_changed do end
# The back key has been pressed
#
# Return `true` if the event has been handled.
fun on_back_pressed: Bool do return false
# A key has been pressed
#
# Return `true` if the event has been handled.
fun on_key_down(key_code: Int, event: NativeKeyEvent): Bool do return false
# A key has been long pressed
#
# Return `true` if the event has been handled.
fun on_key_long_press(key_code: Int, event: NativeKeyEvent): Bool do return false
# Multiple down/up pairs of the same key have occurred in a row
#
# Return `true` if the event has been handled.
fun on_key_multiple(key_code, count: Int, event: NativeKeyEvent): Bool do return false
# A key has been released
#
# Return `true` if the event has been handled.
fun on_key_up(key_code: Int, event: NativeKeyEvent): Bool do return false
end
lib/android/nit_activity.nit:219,1--322,3