I\'m trying to temporarily lock the orientation of the Android device, where most of the time it changes with the sensor. So what I want to do is figure out what the current
I am having similar problems in Froyo
In the activity section of the manifest file I declare:
The main activity has the code to get the information about rotation either when the application is resumed or when a configuration change event is received:
public void onResume() {
super.onResume();
showRotation();
...
}
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
showRotation();
...
}
public void showRotation() {
// int rotationType = getWindowManager().getDefaultDisplay().getOrientation(); // Deprecated
int rotationType = getWindowManager().getDefaultDisplay().getRotation(); // API 8+ (Android 2.2.x or higher)
Log.d(MYTAG, "rotation type: " + rotationType);
}
The problem:
So, what is the solution? should the program be continuously asking to get the current orientation?