-3

I have an application, in which a login screen is displayed when user presses home button or switches to other applications or simply when the application goes to background. But I dont want the login screen to be displayed when the screen orientation changes.

Any suggestion what should be done exactly like is it through implementing onConfigurationChanged, or something else??

A suggestion or an example is much appreciated. Thanks !

Srujan Simha
  • 3,637
  • 8
  • 42
  • 59
  • Didn't like the answer given here? http://stackoverflow.com/questions/14863594/prevent-login-screen-on-screen-rotation-android – 323go Feb 14 '13 at 13:49
  • http://stackoverflow.com/questions/5913130/dont-reload-application-when-orientation-changes You might want to look into 1st answer to this thread. – Chaitanya Chandurkar Feb 14 '13 at 13:49
  • @323go I tried that dude, but its not working ! I'm getting login screen even after implementing it. So thot of starting a seperate thread again :| – Srujan Simha Feb 14 '13 at 13:54
  • Not a good idea to start a separate thread, especially if you didn't understand the previous answer to the same question. Keep in mind that folks will come back to your question in the future, and they have to wade through dozens of identical questions, it's hardly helpful. You could have commented on the replies and folks would have helped you. FWIW, the response I provided is the same pattern I use throughout my apps, and it's working perfectly fine. – 323go Feb 14 '13 at 14:00

1 Answers1

0

First of all, I haven't seen your code, so this is just theoretical.

Watch this: http://2.bp.blogspot.com/-xeMDielmiUo/UOU6lxU5LXI/AAAAAAAAArA/xw4LV_gzjDk/s1600/activity_lifecycle.png

When you change your orientation, you call the method OnPause and onCreate (I think), and they display your login screen.

Use this to know when the application had an orientation change: How to detect orientation change in layout in Android?

After you detected it successfully, you will be able to inticipate the change. Add a variable that will help you to know if the onCreat/onResume was called uppon orientation change or not. And then, on the onCreat/onResume use this variable tohelp you decide if to toshow or not ro show the login screen. Hope it helps :P

Community
  • 1
  • 1
user2051993
  • 276
  • 1
  • 3
  • 6