Handling orientation changes yourself

Posted by synic on Stack Overflow See other posts from Stack Overflow or by synic
Published on 2010-06-03T16:29:26Z Indexed on 2010/06/03 16:34 UTC
Read the original article Hit count: 143

Filed under:

From the documentation regarding the android:configChanges='orientation' attribute of the activity tag in the manifest:

Note: Using this attribute should be avoided and used only as a last-resort. Please read Handling Runtime Changes for more information about how to properly handle a restart due to a configuration change.

Why does it say this?

In the case of threads and networking requests via a service API library, a request could be made with a reference to the original Activity, and then an orientation change could occur, leaving the thread pointing to the old Activity.

While this can be fixed, it's tedious and ugly compared to just handling the configuration changes yourself.

Why should it be avoided?

© Stack Overflow or respective owner

Related posts about android