ANativeActivityCallbacks
These are the callbacks the framework makes into a native application.
Summary
All of these callbacks happen on the main thread of the application. By default, all callbacks are NULL; set to a pointer to your own function to have it called.
Public attributes |
|
---|---|
onConfigurationChanged)(ANativeActivity *activity)
|
void(*
The current device AConfiguration has changed.
|
onContentRectChanged)(ANativeActivity *activity, const ARect *rect)
|
void(*
The rectangle in the window in which content should be placed has changed.
|
onDestroy)(ANativeActivity *activity)
|
void(*
NativeActivity is being destroyed.
|
onInputQueueCreated)(ANativeActivity *activity, AInputQueue *queue)
|
void(*
The input queue for this native activity's window has been created.
|
onInputQueueDestroyed)(ANativeActivity *activity, AInputQueue *queue)
|
void(*
The input queue for this native activity's window is being destroyed.
|
onLowMemory)(ANativeActivity *activity)
|
void(*
The system is running low on memory.
|
onNativeWindowCreated)(ANativeActivity *activity, ANativeWindow *window)
|
void(*
The drawing window for this native activity has been created.
|
onNativeWindowDestroyed)(ANativeActivity *activity, ANativeWindow *window)
|
void(*
The drawing window for this native activity is going to be destroyed.
|
onNativeWindowRedrawNeeded)(ANativeActivity *activity, ANativeWindow *window)
|
void(*
The drawing window for this native activity needs to be redrawn.
|
onNativeWindowResized)(ANativeActivity *activity, ANativeWindow *window)
|
void(*
The drawing window for this native activity has been resized.
|
onPause)(ANativeActivity *activity)
|
void(*
NativeActivity has paused.
|
onResume)(ANativeActivity *activity)
|
void(*
NativeActivity has resumed.
|
onSaveInstanceState)(ANativeActivity *activity, size_t *outSize)
|
void *(*
Framework is asking NativeActivity to save its current instance state.
|
onStart)(ANativeActivity *activity)
|
void(*
NativeActivity has started.
|
onStop)(ANativeActivity *activity)
|
void(*
NativeActivity has stopped.
|
onWindowFocusChanged)(ANativeActivity *activity, int hasFocus)
|
void(*
Focus has changed in this NativeActivity's window.
|
Public attributes
onConfigurationChanged
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onConfigurationChanged)(ANativeActivity *activity)
The current device AConfiguration has changed.
The new configuration can be retrieved from assetManager.
onContentRectChanged
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onContentRectChanged)(ANativeActivity *activity, const ARect *rect)
The rectangle in the window in which content should be placed has changed.
onDestroy
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onDestroy)(ANativeActivity *activity)
NativeActivity is being destroyed.
See Java documentation for Activity.onDestroy() for more information.
onInputQueueCreated
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onInputQueueCreated)(ANativeActivity *activity, AInputQueue *queue)
The input queue for this native activity's window has been created.
You can use the given input queue to start retrieving input events.
onInputQueueDestroyed
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onInputQueueDestroyed)(ANativeActivity *activity, AInputQueue *queue)
The input queue for this native activity's window is being destroyed.
You should no longer try to reference this object upon returning from this function.
onLowMemory
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onLowMemory)(ANativeActivity *activity)
The system is running low on memory.
Use this callback to release resources you do not need, to help the system avoid killing more important processes.
onNativeWindowCreated
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onNativeWindowCreated)(ANativeActivity *activity, ANativeWindow *window)
The drawing window for this native activity has been created.
You can use the given native window object to start drawing.
onNativeWindowDestroyed
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onNativeWindowDestroyed)(ANativeActivity *activity, ANativeWindow *window)
The drawing window for this native activity is going to be destroyed.
You MUST ensure that you do not touch the window object after returning from this function: in the common case of drawing to the window from another thread, that means the implementation of this callback must properly synchronize with the other thread to stop its drawing before returning from here.
onNativeWindowRedrawNeeded
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onNativeWindowRedrawNeeded)(ANativeActivity *activity, ANativeWindow *window)
The drawing window for this native activity needs to be redrawn.
To avoid transient artifacts during screen changes (such resizing after rotation), applications should not return from this function until they have finished drawing their window in its current state.
onNativeWindowResized
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onNativeWindowResized)(ANativeActivity *activity, ANativeWindow *window)
The drawing window for this native activity has been resized.
You should retrieve the new size from the window and ensure that your rendering in it now matches.
onPause
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onPause)(ANativeActivity *activity)
NativeActivity has paused.
See Java documentation for Activity.onPause() for more information.
onResume
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onResume)(ANativeActivity *activity)
NativeActivity has resumed.
See Java documentation for Activity.onResume() for more information.
onSaveInstanceState
Declared inandroid/native_activity.h
void *(* ANativeActivityCallbacks::onSaveInstanceState)(ANativeActivity *activity, size_t *outSize)
Framework is asking NativeActivity to save its current instance state.
See Java documentation for Activity.onSaveInstanceState() for more information. The returned pointer needs to be created with malloc(); the framework will call free() on it for you. You also must fill in outSize with the number of bytes in the allocation. Note that the saved state will be persisted, so it can not contain any active entities (pointers to memory, file descriptors, etc).
onStart
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onStart)(ANativeActivity *activity)
NativeActivity has started.
See Java documentation for Activity.onStart() for more information.
onStop
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onStop)(ANativeActivity *activity)
NativeActivity has stopped.
See Java documentation for Activity.onStop() for more information.
onWindowFocusChanged
Declared inandroid/native_activity.h
void(* ANativeActivityCallbacks::onWindowFocusChanged)(ANativeActivity *activity, int hasFocus)
Focus has changed in this NativeActivity's window.
This is often used, for example, to pause a game when it loses input focus.