0

I want my app to go from portrait to landscape and change from layout1 to layout2 but not restart the activity.
It goes from layout1 to layout2 nicely, but restarts the activity every time it switches from portrait to landscape and landscape to portrait and i want to just run the activity once then keep it there.

Any help is greatly appreciated thank you.

1 Answers1

1

You can achieve this by add android:configChanges="orientation" to your activity in manifest and handle the screen contents manually by overriding onConfigurationChanged

waqaslam
  • 67,549
  • 16
  • 165
  • 178
  • when i add that to the activity, my layout2(landscape) looks layout1 cuz every thing is messed up and my stuff isnt in the right positions, so i no its not changing. and what do i put in onConfigurationChanged? – Spammy Spamsalot Apr 19 '12 at 19:38
  • 1
    inflate new views to your parent layout in onConfigurationChanged – waqaslam Apr 19 '12 at 19:44
  • perhaps try using `setContentview` in **onConfigurationChanged** the same way as you do in **onCreate** method – waqaslam Apr 19 '12 at 21:22