Cheok Yan Cheng
Cheok Yan Cheng

Reputation: 42828

Having different application orientation for tablets and phones

I know I can specific application orientation (Portrait or Landscape) through manifest file.

My application will run on both tablets and phones. However, currently, I would like to have Landscape orientation for tablet application, and Portrait for phone application.

May I know, how I can achieve this, by only having to build a single APK file. Or, do I need 2 different APK files for tablets and phones?

Upvotes: 0

Views: 218

Answers (1)

Bob
Bob

Reputation: 23010

put this in onCreate method:

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);

sets the orientation to device default.

Upvotes: 4

Related Questions