Stumped - rotation does not change view


#1

I’m stumped on this issue involving rotation. I created a res/layout-land/activity_quiz.xml and it shows correctly in landscape mode in the ‘Graphical Layout’ view in Eclipse. But, when i run the emulator and rotate the device via ‘Ctrl + F12’ the device rotates but the view does not change. Furthermore, when looking at LogCat I do not see calls to onDestroy() and onCreate(). I tried adding android:configChanges=“keyboard|keyboardHidden” to my AndroidManifest.xml file and overriding onConfigurationChanged() yet I never see that method called.

My minSdkVersion == 8 and targetSdkVersion == 19.

Any ideas?


#2

Okay, trying to debug what is going on. Added some code to display the orientation. Noticed that the getOrientation() method of the Display object is deprecated so used the getRotation() method. Here is the code:

		[code]@Override
		public void onClick(View v) {
			mCurrentIndex = (mCurrentIndex + 1) % mQuestionBank.length;
			updateQuestion();	
			// Generate toast with current orientation
			Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
			int orientation = display.getRotation();
			Log.d(TAG, "Orientation value = " + orientation);
			Log.d(TAG, "ORIENTATION_PORTRAIT = " + Surface.ROTATION_0);
			Log.d(TAG, "ORIENTATION_LANDSCAPE = " + Surface.ROTATION_180);
			// int messageResId = 0;
			switch (orientation) {	
			case Surface.ROTATION_0:
				// messageResId = R.string.portrait_toast;
				Log.d(TAG, "Portrait detected");
				break;
			case Surface.ROTATION_180:
				// messageResId = R.string.landscape_toast;
				Log.d(TAG, "Landscape detected");
				break;
			default:
				Log.d(TAG, "Default detected");
				break;
			}
		}

[/code]
But, when i run the emulator no matter the rotation I always get back ROTATION_0. Beginning to think there is something wrong with the specific emulator i’m using. Here are my AVD details:

Name: Nexus_API_19
CPU/ABI: ARM (armeabi-v7a)
Path: <>
Target: Google APIs (API level 19)
Skin: 720x1280
hw.dPad: no
hw.lcd.density: 320
avdi.ini.encoding: ISO-8859-1
hw.device.hash: 1197498893
hw.camera.back: none
disk.dataPartition.size: 200M
hw.gpu.enabled: yes

Platform is 4.4.2. Also, i checked the Display->Settings->Auto-rotate screen and that option is checked.

Any ideas?


#3

Well, did a little more research and seems like it’s a bug:

https://code.google.com/p/android/issues/detail?id=34237

Will give up for now and move on.