3

Jelly Bean 4.3 (API 18) added a couple new screenOrientation values.

http://developer.android.com/reference/android/R.attr.html#screenOrientation

http://developer.android.com/reference/android/content/pm/ActivityInfo.html#SCREEN_ORIENTATION_BEHIND

I suppose first: is there a difference between "orientation" and "rotation"? Or is the documentation just using inconsistent wording?

Then:

unspecified

No preference specified: let the system decide the best orientation. This will either be the orientation selected by the activity below, or the user's preferred orientation if this activity is the bottom of a task. If the user explicitly turned off sensor based orientation through settings sensor based device rotation will be ignored. If not by default sensor based orientation will be taken into account and the orientation will changed based on how the user rotates the device. Corresponds to SCREEN_ORIENTATION_UNSPECIFIED.

user

Use the user's current preferred orientation of the handset. Corresponds to SCREEN_ORIENTATION_USER.

fullUser (New)

Respect the user's sensor-based rotation preference, but if sensor-based rotation is enabled then allow the screen to rotate in all 4 possible directions regardless of what the device will normally do (for example some devices won't normally use 180 degree rotation). Corresponds to SCREEN_ORIENTATION_FULL_USER.

What's the difference? In practice currently, I believe that setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED) is the way to tell the activity to rotate based on the sensor, if Rotation is enabled system-wide. So then how is fulluser different?

Likewise,

nosensor

Always ignore orientation determined by orientation sensor: the display will not rotate when the user moves the device. Corresponds to SCREEN_ORIENTATION_NOSENSOR.

locked (New)

Screen is locked to its current rotation, whatever that is. Corresponds to SCREEN_ORIENTATION_LOCKED.

Any difference?

Duke
  • 843
  • 1
  • 8
  • 10

2 Answers2

4

Is there a difference between "orientation" and "rotation"? Or is the documentation just using inconsistent wording?

Even though you see Orientation and Rotation as synonyms(as do most I think, including me), the differences lie in their respective definition. Where Orientation affords you two choices, Rotation gives you four. What will the extra two choices be used for? That will depend on you.

Say you come up with a convenience app which includes an alarm clock, a calculator, a weather informer and a currency converter. You can assign a different rotation to each of these and allow the user to navigate between the four views by rotating the device.

Another (fictional) example can be a homescreen which displays different widget groups based on rotation angle.

I tried some of the screenOrientation options and this is what I found:

fullUser: Stuck to the default rotation of 0 degrees.

user: Allowed rotation values 0, 90 and 270.

fullSensor: Allowed all 4 rotation values.

unspecified: Same behavior as user setting

locked and nosensor: Stuck to 0 degree rotation

As you see from the tests, not much is clarified as to what each screenOrientation values does. Not sure why I am not being able to reproduce the effect defined on the resource page.

Community
  • 1
  • 1
Vikram
  • 51,313
  • 11
  • 93
  • 122
-1

fullUser: Allowed rotation values 0, 90, 180 and 270 when auto-rotate enabled, otherwise the default one.

user: Allowed rotation values 0, 90 and 270 when auto-rotate enabled, otherwise the default one. But on some tablets it's also allowed to have 4 orientations...

@Vikram when you got only 0 degress with fullUser, I guess you're using a device apilevel < 18. ;)

superuser
  • 768
  • 7
  • 9