How to force portrait mode based on screen size?

applejaxapplejax CAMember ✭✭

I would like my app to run only in portrait mode if the device is a smart phone, but run in both landscape and portrait if the device is a tablet.

So far, the only way I see to force portrait mode is by setting it in the Activity's attributes. However, this does not allow me to check the device size and set the orientation accordingly.

Is there a way to force an orientation programmatically, without the use of an attribute, after checking the device screen-size?


  • TeooTeoo GRMember

    Same Here !!!!

  • LjusnanLjusnan DEMember ✭✭✭

    You dont' have to set this in the Acitivity's attributes, you can also set in OnCreate: RequestedOrientation = ScreenOrientation.Portrait;

Sign In or Register to comment.