I have a doubt as to leave the screen only in portrait and reversePortrait,
tested code, but only when the screen turns reversePortrait, I can not go
back to portrait. why?
in my MainActivity.class
@Overridepublic void onConfigurationChanged(Configuration
newConfig) {super.onConfigurationChanged(newConfig);final int rotation
= (((WindowManager) getSystemService(WINDOW_SERVICE))
.getDefaultDisplay().getOrientation());
unlockScreenOrientation();
if (!mScreenOrientationLocked) {
if(rotation == Surface.ROTATION_0){
MainActivity.this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}else{
MainActivity.this.setRequestedOrientation(9);
}
mScreenOrientationLocked = true;
}
}
private void unlockScreenOrientation() {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
mScreenOrientationLocked = false;}
In my AndroidManifest.xml
<activity android:launchMode="singleTop"
android:name=".MainActivity"
android:configChanges="orientation"
android:screenOrientation="sensor"
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"/>
Can anyone help me please?
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.