安卓的onCreate()方法调用两次当设备旋转。 (ICS)

问题描述:

我开发在Android平板电脑应用程序,我需要管理的应用方向。我每一次当我旋转设备的onCreate(将被称为一个问题)。

I'm developing on an android tablet application and I have to manage application orientation. I got a problem that every time when I rotate the device onCreate() will be called.

我固定在蜂窝(3.1)这个问题,通过设置该行Manifest.xml文件在活动标记,它工作得很好。

I fixed this problem on Honeycomb (3.1) by set this line in Manifest.xml file at the activity tag and it works well.

          android:configChanges="keyboardHidden|orientation"

但这个问题又回来了,当我测试我的ICS平板电脑的应用程序。有谁知道如何解决这个问题?

But this problem came back again when I test my app on ICS Tablet. Does anyone know how to fix this problem?

感谢

问候。

如果你的目标是 API级> 13 您必须添加屏幕尺寸标志作为报告的文档:

If you are targeting an API level > 13 you have to add the screenSize flag as reported in the doc:

  android:configChanges="keyboardHidden|orientation|screenSize"