I am new to B4A so please be nice. I am currently creating a game and want to make my application able to the change the layout variant when the screen rotates. What code can I use to make this possible. I have already designed my 2 layout variants for this, but how can I make my application detect when the screen changes and then change the layout automatically.
If you design a layout for both portrait and landscape then Android will handle that for you.
If you want to do it through code then you could see if Activity.Height > Activity.Width then load the portrait variant. Otherwise if width is > height then load landscape.
Obviously you also need to make sure that both orientations are permitted in the project's settings.