0

I need to detect before the orientation changes so that i know if it is orientation change i don't have to add a score to database inside a fragment. Is it possible to do that? OrientationChangeListener and configuration change didn't work for me, as i understand config updates after the fact and orientation listener at every degree the device is moved.

Danny Watts
  • 579
  • 1
  • 6
  • 18
  • 1
    This is not great practice, but you can try overriding `onConfigurationChanged`. See here: http://stackoverflow.com/a/5726776/379245 – BVB Mar 12 '14 at 20:04
  • thanks, but does it call the method prior to DESTROYING the fragment/activity, or after the fact? because i need it before it destroys it. – Danny Watts Mar 12 '14 at 20:14
  • If you use that, your activity will not be destroyed and recreated. That's the downside. You will have to handle everything in the onConfigurationChanged function yourself. – BVB Mar 12 '14 at 20:15
  • 1
    The activity *is* destroyed *after* the orientation change. Therefore, onSaveInstanceSate() is called between orientation change and onDestroy(). – Simon Mar 12 '14 at 20:32
  • Thank you, that clears it up, I will give it a try :) – Danny Watts Mar 12 '14 at 22:19

0 Answers0