Is it an atomic operation?
I mean is it possible that anything else gets executed on the main thread during an orientation change?
For example, let's say the flow on the main thread is something like this:
someOperation -> orientationChangeStart -> someOtherOperation -> orientationChangeEnd
Is this possible?
Can someOtherOperation
get executed on the UI thread while an orientation change is in progress?
Thanks in advance.
Yes, it is atomic operation.
in pseudo it looks like:
void setNewOrientation(int state) {
currentState = state;
runOrientationChangedEvent();
}
And then usually Activity
is re-created. Only re-creating of Activity adds to the message queue, so it is possible to see if change device orientation fast enough.
You cannot get start and end of this process, because it just changes a few int variables which can tell you about current orientation like orientation:
getActivity().getResources().getConfiguration().orientation
or rotation
getWindowManager().getDefaultDisplay().getRotation();
So you can get event only after orientation is changed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With