I have developed one application and configured its orientation is Landscape so it will always display on landscape view on the device.
Now i want to rotate it 180
In your AndroidManifest.xml
file, you need to configure the <activity>
to use the orientation from the sensor. This should be the default, but you can force it to the sensor's orientations, for all 4 possible orientations, with android:screenOrientation="fullSensor"
. See http://developer.android.com/guide/topics/manifest/activity-element.html#screen
EDIT: If you want to enable all but one orientation, you could disable that orientation by intercepting the orientation change event and quashing it in your Activity
:
public void onConfigurationChanged(Configuration config) {
if (config.orientation != Activity.ORIENTATION_PORTRAIT) {
setRequestedOrientation(config.orientation);
{
}
(This is off the top of my head but think it works, or something nearly like it.)
You need to tell Android to let the app handle orientation changes too in your <activity>
with android:configChanges="orientation"
.
specify:
android:screenOrientation="sensorLandscape"
in your AndroidManifest.xml
. This will transform application between landscape and reverseLandscape.