0

Suppose that within an activity my initial screen orientation is landscape. In the same activity, I would like to add a button which changes the screen orientation from landscape to portrait.

Is this possible in any way, or should I switch to a new activity ?

Thanks.

Pumpkin
  • 1,993
  • 3
  • 26
  • 32
  • Initially in my activity a, the screen orientation is fixed to landscape as described in android manifest file, this works as intended for many layouts, but on the last layout - I know where I call it - I would like to change that line in manifest file from landscape to portrait – Pumpkin Sep 06 '11 at 16:48

2 Answers2

1

Use Activity.setRequestedOrientation() method

Andrej Cvoro
  • 371
  • 1
  • 5
0

you can add new views to your layout, but first you need to detect the orientation change which is explained in the following link how it's done.

How to detect orientation change in layout in Android?

hope this helps

Community
  • 1
  • 1
Yashwanth Kumar
  • 28,931
  • 15
  • 65
  • 69