Android Activity, how to override manifest's android:configChanges with Java code?

前端 未结 2 865
说谎
说谎 2020-12-06 20:34

I\'m coding a custom Activity class (using it as a super class for my other Activity classes) where it\'s overriding many default functionalities. One of these functionaliti

2条回答
  •  一整个雨季
    2020-12-06 21:07

    You'll still need to include the attribute in the XML but you can handle it in Java too; see my blog post here: http://c0deattack.wordpress.com/2010/12/25/dealing-with-screen-orientation-changes-manually/

    Edit: You cannot set the configChanges attribute programmatically. I guess it's to do with the way an Activity is created. They're created from the XML first and then the overridden methods in your activity implementation are invoked. There's nothing in the API that lets you change the configChanges attribute.

提交回复
热议问题