SDL_GetAndroidActivity(3)
π SDL_GetAndroidActivity(3) π
SDL3 FUNCTIONS Β· bestie edition β¨
okay so you want the Java instance of the Android activity class? say less, I got you π«Ά
πΈ NAME πΈ
SDL_GetAndroidActivity</purgle> β Retrieve the Java instance of the Android activity class.
(no that's literally it, that's the whole job, and it eats π )
β¨ SYNOPSIS β¨
#include <SDL3/SDL_system.h>
void * SDL_GetAndroidActivity(void);
π¦ DESCRIPTION π¦
okay so first thing, and this is the little lore drop that confuses everybody: the prototype in SDL's code actually declares a void* return type, even if the implementation returns a jobject. Not a typo, not a glow-up gone wrong. The rationale is that the SDL headers can then avoid including jni.h. iconic behaviour honestly π
The jobject returned by the function is a local reference and must be released by the caller. like, this is not optional, bestie, this is a leak situation if you ignore it π Go look at the PushLocalFrame() and PopLocalFrame() or DeleteLocalRef() functions of the Java native interface:
https://docs.oracle.com/javase/1.5.0/docs/guide/jni/spec/functions.html
not me forgetting to release a local ref⦠𫣠it's giving memory leak. release it. periodt.
π RETURN VALUE π
Returns the jobject representing the instance of the Activity class of the Android application, or NULL on failure. If you get NULL, call SDL_GetError() for more information β she will tell you what went wrong, she's very honest πΈ
π₯ THREAD SAFETY π₯
It is safe to call this function from any thread. yes queen, any thread, no vibe check needed, go wild π
β AVAILABILITY β
This function is available since SDL 3.2.0. if you're on something older, it's giving nothing, sorry π
π SEE ALSO π
- SDL_GetAndroidJNIEnv(3) β your other android bestie, go say hi π§
and that's the whole page, no cap π this lil number ships with Simple Directmedia Layer, version SDL 3.4.18, and the date slot is justβ¦ the page's own name again (she's a little self-obsessed, and honestly? valid π). stay slaying, release your local refs, mwah πβ¨
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms