I have a single app, one activity and I both load and resize my layouts via code onto panels. I then place these panels however I want. I am using version B4A 1.92 (I believe).
In my Activity_Create sub, I first check the screen size to see if the device is a phone or a tablet (this works fine using code shared here on the forums by Erel). If the device is a Phone, I setorientation to Portrait, if a Tablet, then I setorientation to Landscape via the Phone library. I do this before anything else.
My initial activity orientation setting in the designer is set to BOTH.
Getting to the problem..
When using the phone and holding the phone either landscape or portrait, the app loads once in portrait…as it should… no problem.
When using the Tablet and holding the tablet landscape, the app loads once in landscape…as it should…no problem.
Now the problem
When using the Tablet and holding the tablet “portrait”, the app begins to load landscape, but only at the top half of the screen and skewed. This occurs for about 3 seconds. Then the screen goes blank and then loads the correct way (like when I hold the tablet landscape).
It appears that the app is starting to load and then stops (or fires an orientation change etc.), and then reloads and calls Activity_Create again and loads things the correct way). Why does this happen? I am setting the orientation before I load anything else (splashscreen etc).
Also, the landscape setting is the only setting that reloads (Activity_Create called) everything after I wake the device. Everything reloads as if the app initially wants to go portrait, but then changes to landscape. This does not happen when I force the device in portrait mode. I tested this issue on the same device (Kindle Fire), and I get a completely different “wake” result when forcing landscape vs. portrait in code.
In my Activity_Create sub, I first check the screen size to see if the device is a phone or a tablet (this works fine using code shared here on the forums by Erel). If the device is a Phone, I setorientation to Portrait, if a Tablet, then I setorientation to Landscape via the Phone library. I do this before anything else.
My initial activity orientation setting in the designer is set to BOTH.
Getting to the problem..
When using the phone and holding the phone either landscape or portrait, the app loads once in portrait…as it should… no problem.
When using the Tablet and holding the tablet landscape, the app loads once in landscape…as it should…no problem.
Now the problem
When using the Tablet and holding the tablet “portrait”, the app begins to load landscape, but only at the top half of the screen and skewed. This occurs for about 3 seconds. Then the screen goes blank and then loads the correct way (like when I hold the tablet landscape).
It appears that the app is starting to load and then stops (or fires an orientation change etc.), and then reloads and calls Activity_Create again and loads things the correct way). Why does this happen? I am setting the orientation before I load anything else (splashscreen etc).
Also, the landscape setting is the only setting that reloads (Activity_Create called) everything after I wake the device. Everything reloads as if the app initially wants to go portrait, but then changes to landscape. This does not happen when I force the device in portrait mode. I tested this issue on the same device (Kindle Fire), and I get a completely different “wake” result when forcing landscape vs. portrait in code.