add orientation to the configChanges attributes of your activity and handle the rotation layout changes yourself.
On Wednesday, January 30, 2013 12:16:59 PM UTC-5, Davide Moriello wrote: > > Thank you a lot Nobu and Kostya you helped me a lot. > > Kostya is right! This is what is happening! Thank you for understaing me, > my english is not so good :-( > Now, how can I tell the code to do not re-create on orientation change > when you lock the screen? > The code should handle it without crashing, but it would not be playable > (a game design decision), so if it change orientation when the screen is > locked is not a problem. But it should go back in landscape when you unlock > your phone. > > Thank you a lot. > > Il giorno mercoledì 30 gennaio 2013 17:17:34 UTC+1, Kostya Vasilyev ha > scritto: >> >> Are you locking the device in landscape mode? >> >> On phones, locking the screen represents an orientation change, a locked >> screen is always in portrait mode. >> >> This means that if your activity is the top-most one on the screen, it >> will be destroyed and re-created, and then again when you unlock the device. >> >> Can your code handle an orientation change without crashing? >> >> -- K >> >> 2013/1/30 Davide Moriello <[email protected]> >> >>> Hello, I'm developing an android app for some time now. Everything is >>> going well. When I close my app with the home button and I reopen it there >>> aren't any problems or crashes. >>> But, when I have my app open and I lock my screen the app create a new >>> istance of the activity and call again onCreate when the screen is >>> locked... so crash! >>> >>> the code of my activity is here >>> http://pastebin.com/j1mTRUnB >>> >>> >>> What can this be? Any suggestion? Thank you a lot =) >>> >>> -- >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Android Developers" group. >>> To post to this group, send email to [email protected] >>> To unsubscribe from this group, send email to >>> [email protected] >>> For more options, visit this group at >>> http://groups.google.com/group/android-developers?hl=en >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Android Developers" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/groups/opt_out. >>> >>> >>> >> >> -- -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en --- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

