Android:configchanges Properties Summary

Source: Internet
Author: User

Original address: http://blog.csdn.net/zhaokaiqiang1992/article/details/19921703

Component activity in Android can specify parameter Android:configchanges in the Manifest.xml file to capture changes in the state of the phone. The Android:configchanges property is added to the activity, and the notifier calls the onconfigurationchanged () function when the specified property (Configuration changes) changes.

Set method: Use the following fields with the "|" Symbols separated, for example: "Locale|navigation|orientation"

The "MCC" mobile country number, consisting of three digits, each country has its own independent MCC, which identifies the country where the mobile phone user belongs.
"MNC" mobile network number, in a country or region, used to differentiate the service providers of mobile phone users.
Changes in the region where "locale" is located.
The "touchscreen" touchscreen has changed. (This should not happen often.) )
"Keyboard" keyboard mode changes, for example: User access to external keyboard input.
"Keyboardhidden" user opens the phone hardware keyboard
The "navigation" navigation type has changed. (This should not happen often.) )
"Orientation" device rotation, landscape display and vertical display mode toggle.
"Fontscale" Global font size scaling has changed

For the Android:configchanges property, it is generally considered that the following:
1, do not set the activity of the android:configchanges, the screen will recall the various life cycle, cut across the screen will be executed once, When you cut the vertical screen two times

2, set the activity's android:configchanges= "orientation", the screen will recall the life cycle, cut horizontally, vertical screen will only be executed once

3, When you set the activity's android:configchanges= "Orientation|keyboardhidden", the screen does not recall the individual lifecycles, only the Onconfigurationchanged method is executed

However, since Android 3.2 (API 13), after setting the activity's android:configchanges= "Orientation|keyboardhidden", the individual lifecycles will be recalled again. Because screen size also starts to change with the device's shift. So, in cases where the Minisdkversion and Targetsdkversion properties set in Androidmanifest.xml are greater than or equal to 13, if you want to prevent the program from reloading the activity at run time, in addition to setting the " Orientation ", you must also set the" ScreenSize ".
Workaround:
Androidmanifest.xml set android:configchanges= "Orientation|screensize"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.