diff --git a/library/modules/platform/android.sx b/library/modules/platform/android.sx index 8e51647..8bd1d17 100644 --- a/library/modules/platform/android.sx +++ b/library/modules/platform/android.sx @@ -390,7 +390,13 @@ impl Platform for AndroidPlatform { // bootstrap is too early. if !self.safe_insets_queried and g_android_activity != null and self.egl_surface != null { t : s32 = 0; l : s32 = 0; b : s32 = 0; r : s32 = 0; - sx_android_query_safe_insets(g_android_activity, @t, @l, @b, @r); + attached : bool = false; + env := sx_android_get_env(g_android_activity, @attached); + if env != null { + clazz := sx_android_activity_clazz(g_android_activity); + sx_query_safe_insets_jni(env, clazz, @t, @l, @b, @r); + if attached { sx_android_detach_env(g_android_activity); } + } inv : f32 = if self.dpi_scale > 0.0 then 1.0 / self.dpi_scale else 1.0; self.safe_top = xx t * inv; self.safe_left = xx l * inv;