0

I'm developing an Android Application which is locked to portrait mode for phones. In one part of the application, the user can look at some nice Graphs. In this part (only), it would be nice to allow the user to change to landscape mode - if he wants to.

I know this would be quite simple if the Graphs were contained in their own activity, but unfortunately, they are not. They are shown by Fragments which in turn are shown in a somewhat complex Tab Layout.

In other words; I want to have to whole app locked to portrait mode except when the user is in a specific Fragment. Then I want to allow him to allow him to change to landscape mode (Not neccessarily by rotating the device, other solutions are welcome too). When the user navigates away from that part of the app from Landscape mode, the portrait mode should be restored.

Is there any way this can be achieved?

Joakim
  • 3,224
  • 3
  • 29
  • 53
  • http://stackoverflow.com/questions/18268218/change-screen-orientation-programatically-using-a-button it might help you. – Harish Vats Jun 08 '16 at 08:53

1 Answers1

0

you can do it dynamically this way :

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
abdoulayeYATERA
  • 209
  • 1
  • 2