Book Image

Xamarin Mobile Application Development for Android, Second Edition

Book Image

Xamarin Mobile Application Development for Android, Second Edition

Overview of this book

Table of Contents (18 chapters)
Xamarin Mobile Application Development for Android Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The Android behavior on configuration changes


All modern smartphones and tablets switch between portrait and landscape modes in response to the way a user rotates the device. The Android application is expected to respond to the configuration changes and displays appropriate layouts for the current device configuration. The Android device configuration can be changed at runtime in many forms, such as device orientation changes, device language changes, device font updates, device connected to external displays, device connected to docks, and so on. In all of the earlier cases, Android restarts the running activity, loads alternative resources if available, to properly load your application for the given configurations. The activity goes through a series of life cycle methods, such as OnDestroy(), followed by OnCreate() to deal with the activity restart behavior.

For example, if you are running your application on Nexus 5 device with 1080 x 1920 resolution in the portrait mode, and while the...