Skip to main content

Posts

Showing posts from December, 2014

How to keep objects when activity is configured

When activity is reconfigured(e.g. rotating the screen), by default whole activity with its objects will be destoyed and recreated, because Android may need alternative resources to match current screen size. Related explanation on developer.android.com site: Caution: 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).