I snap a photo, and it gets placed onto an ImageView. When the user sees the page where the Image View is, and I turn the phone sideways where the orientation is horizontal, the app immediately returns to the app's main screen. Any ideas?
Asked
Active
Viewed 306 times
1 Answers
2
Rotating the phone recreates the activity. Implementing the onSaveInstanceState()
and onCreate()
methods to properly save and restore the state of the activity should fix the problem.

Alex Jasmin
- 39,094
- 7
- 77
- 67
-
Pardon my ignorance on that - but do you mean for each class? I have super.onCreate(savedInstanceState); in the class that it is changing orientation in, and it still goes back to the app's home screen. – Sapp Nov 18 '10 at 00:40
-
What do you mean by homes screen? Does it switch to another activity? Does a popup disappear? Does the view get reset? – Alex Jasmin Nov 18 '10 at 00:58
-
it goes from one of my classes called by setContentView back to my app's main class – Sapp Nov 18 '10 at 01:16
-
Your activity is destroyed by default when you rotate the screen. If you always call `setContentView()` with the same view inside `onCreate()` it will always switch back to it. – Alex Jasmin Nov 18 '10 at 02:06
-
If you are completely replacing the view perhaps it would be simpler to switch to another activity instead. – Alex Jasmin Nov 18 '10 at 02:18