0

I have based my code for 2.3.3 and testing on device 4.0.4 Orientation change works on activity but I am not able to get the orientation change handler.

Although i have added to stuff required but am not sure it is complete This is what i have added

mainfest file

<activity
        android:name="com.MainActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar"
        android:configChanges="orientation|keyboardHidden" >

Acivity

@Override
public void onConfigurationChanged(Configuration newConfig) {
    super.onConfigurationChanged(newConfig);

    // Checks the orientation of the screen
    if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
        Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
    } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
        Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
    }
  }
  • Try adding "screenSize" (http://stackoverflow.com/questions/14062663/older-devices-and-androidmanifest-configchanges-screensize) – Ken Wolf Jun 18 '13 at 12:57
  • screenSize is not available in 2.3.3 –  Jun 18 '13 at 13:17
  • I know, but this is why you are having the problem on 4.0.4. Just set your project to use 4.X, add screenSize, set the right minSDK values, and test again. – Ken Wolf Jun 18 '13 at 13:18
  • I am sorry I didnt understand. I have to make the code compatible to 2.3.3 devices... –  Jun 18 '13 at 13:20
  • 2.3.3 devices will ignore it, don't worry. – Ken Wolf Jun 18 '13 at 13:20

0 Answers0