Window size is wrong after Event.DEACTIVATE on Android

Hello

I try to make fullscreen mode in the app on Android (ver. 5.0.2). That works fine when started, but after switch between apps and come back, - i see wrong window size (red blank in the place where should be navigation buttons). Why it’s happening?

class Main extends Sprite {

	inline private static var WINDOW_WIDTH:Int = 320;
	inline private static var WINDOW_HEIGHT:Int = 192;

	public function new() {
		super();
		addEventListener(Event.ADDED_TO_STAGE, init);
	}
	
	private function init(e:Event):Void {
		removeEventListener(Event.ADDED_TO_STAGE, init);

		...

		stage.addEventListener(Event.RESIZE, resizeListener);
	}
	
	private function resizeListener(e:Event):Void {
		stage.scaleX = stage.stageWidth / WINDOW_WIDTH;
		stage.scaleY = stage.stageHeight / WINDOW_HEIGHT;
	}
}

First launch:

After switch tab window:

It’s looks like immersive mode doesn’t work fully after back in app, - allocates space for the navigation buttons. Can’t display anything on the red blank.

Sorry for my english D:

I solved this problem, but need see into this. why it’s happening?

I added this code in onResume listener in MainActivity.java:

if (Build.VERSION.SDK_INT >= 19) {
		getWindow ().getDecorView ().setSystemUiVisibility (View.SYSTEM_UI_FLAG_FULLSCREEN);
}

or just call onWindowFocusChanged:

onWindowFocusChanged(true);

I thought that this function should be do onWindowFocusChanged, but it’s doesn’t works after resume application.

1 Like

After update openfl/lime the problem is disappeared! No need override GameActivity at present!

1 Like