Why the android activity get's destroyed on rotation?

荒凉一梦 提交于 2019-12-06 07:54:50

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

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)..

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!