I have an Activity which I want to be finished when user rotates the device.
Here is my code snippet I’m using:
@Override
public void onConfigurationChanged(Configuration newConfig)
{
super.onConfigurationChanged(newConfig);
Log.d("Orientation Changed", "Orientation Changed");
this.finish();
}
and in my Menifist.xml I’ve added the attribute like this.
<activity android:name=".DetailActivity" android:configChanges="keyboardHidden|orientation" android:screenOrientation="landscape"></activity>
but this.finish() is not called when Orientation is changed.
Further I’ve started this Activity through Orientation Changed of the Activity prior to it.
Any help or suggestion will be appreciated.
Cheers!
The
android:screenOrientation="landscape"bit is your problem. This will make your Activity always be inlandscapemode.