Does anybody know how to cope the problem?
Using the android.app.Activity#setRequestedOrientation(SCREEN_ORIENTATION_LANDSCAPE)
method almost always causes the showing a black screen for a split second during the rotation.
But if I rotate the smartphone itself, then the black screen never appears.
How to get rid of the black screen? Is it the Android issue of the setRequestedOrientation()
method, or I do something wrong?
EDIT: AFAIK the black screen with setRequestedOrientation()
call could happen if we have quite heavy layout, when it takes some more time to initialize it in the UI thread. If you try to call setRequestedOrientation()
for instance in a "Hello World!" app with a light layout, you won't see the black screen. So, the loading on the UI thread can be the cause of the black screen when you rotate with setRequestedOrientation()
. But, in other hand why it never appears when I rotate the screen changing the phone orientation?