I created a sample orientation checker program. If portrait mode and I tilt the phone the other way around, I want my sample app to go back. After reading a large number of questions on this issue: "Acquired we need to use:
onConfigurationChanged(Configuration newConfig)
I tried the following:
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
Configuration c = getResources().getConfiguration();
Log.e("Config",""+c);
if (c.orientation == Configuration.ORIENTATION_PORTRAIT)
{
Log.e("On Config Change","portrait");
}
else if (c.orientation == Configuration.ORIENTATION_LANDSCAPE)
{
Log.e("On Config Change","LANDSCAPE");
}
}
manifest.xml
android:configChanges="orientation"
even tried it
android:configChanges="orientation|screensize"
Strange I do not receive logs inside the OnConfigurationChange method.
Not sure. What is the problem?
I use a minimum of api 8 to target Api 18.
Can someone help me with this?
Thank!
source
share