问题
I always wondered what is the benefit of destroying activity on rotation? I mean you can
specify android:configChanges="orientation|screenSize"
and it won't get destroyed
but what's the reason for destroying it
回答1:
Because generally the UI gets all messed up when we have built the screen for portrait mode(say) and the screen gets rotated, so android os thinks that we might need to refactor our layout or maybe use a new layout during onOrientationChanged, maybe that's why the activity gets created again
回答2:
Your activity will be destroyed and recreated each time the user rotates the screen. When the screen changes orientation, the system destroys and recreates the foreground activity because the screen configuration has changed and your activity might need to load alternative resources (such as the layout)
also mathematically aspect ratios change - all these constitute to the os recreating the activity to know how to do work -(this might not be 100% true- but true)..
来源:https://stackoverflow.com/questions/27233787/why-the-android-activity-gets-destroyed-on-rotation