The screen orientation has changed — the user has rotated the device.
Note: If your application targets API level 13 or higher (as declared by the
targetSdkVersionattributes), then you should also declare the
"screenSize"configuration, because it also changes when a device switches between portrait and landscape orientations. More
You can just put on your activity on manifest file:
If you still need to force portrait for some reason, sensorPortrait may be better than portrait for Android 2.3+; this allows for upside-down portrait, which is quite common in tablet usage.
Go to this link may be h elpful: http://code.google.com/android/reference/android/R.styleable.html#AndroidManifestActivity_screenOrientation