Allow Android to switch between the screen and the current activity is not destroyed

Source: Internet
Author: User

Find information online:

For node <activity/> Add Property " android:configchanges=" Orientation|keyboardhidden|screensize "" as follows:

1         <Activity2             Android:name=". Mainactivity "3 Android:label= "@string/app_name" 4 android:configchanges= "Orientation|keyboardhidden|screensize" >5             <Intent-filter>6                 <ActionAndroid:name= "Android.intent.action.MAIN" />7 8                 <categoryAndroid:name= "Android.intent.category.LAUNCHER" />9             </Intent-filter>Ten         </Activity>

Note point: (no test)

Android2.3 Use the above "android:configchanges=" Keyboardhidden|orientation "" before it can be done. However, after 4.0. You must use this property "android:configchanges=" Orientation|keyboardhidden|screensize "" to avoid activity reloading the class does not extend the above-mentioned rebuild process!

ZC: Write directly "android:configchanges=" orientation|keyboardhidden|screensize "" no matter what version it is ...

PS: You can also override the function onconfigurationchanged, to do something in the event of the screen, but I do not need it, regardless of it ...

Reference pages:

Http://www.cnblogs.com/hibraincol/archive/2010/09/18/1829862.html

http://blog.csdn.net/junhuahouse/article/details/38109125

Web content saved in: Baidu Cloud Codeskill33--"All Files > from __ page > Android_eclipse > Let Android switch between the screen and the current activity is not destroyed"

X

Allow Android to switch between the screen and the current activity is not destroyed

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.