diff --git a/src/platform_impl/android/mod.rs b/src/platform_impl/android/mod.rs index 68e4cf668b6..48dee0322c3 100644 --- a/src/platform_impl/android/mod.rs +++ b/src/platform_impl/android/mod.rs @@ -596,6 +596,21 @@ impl EventLoop { } } + if self.running && resized { + let size = if let Some(native_window) = self.android_app.native_window().as_ref() { + let width = native_window.width() as _; + let height = native_window.height() as _; + PhysicalSize::new(width, height) + } else { + PhysicalSize::new(0, 0) + }; + let event = event::Event::WindowEvent { + window_id: window::WindowId(WindowId), + event: event::WindowEvent::Resized(size), + }; + sticky_exit_callback(event, self.window_target(), control_flow, callback); + } + sticky_exit_callback( event::Event::MainEventsCleared, self.window_target(), @@ -604,21 +619,6 @@ impl EventLoop { ); if self.running { - if resized { - let size = if let Some(native_window) = self.android_app.native_window().as_ref() { - let width = native_window.width() as _; - let height = native_window.height() as _; - PhysicalSize::new(width, height) - } else { - PhysicalSize::new(0, 0) - }; - let event = event::Event::WindowEvent { - window_id: window::WindowId(WindowId), - event: event::WindowEvent::Resized(size), - }; - sticky_exit_callback(event, self.window_target(), control_flow, callback); - } - *pending_redraw |= self.redraw_flag.get_and_reset(); if *pending_redraw { *pending_redraw = false;