Jutikorn Jutikorn - 6 days ago 6
Android Question

Android onCreate() Method called twice when device rotated. (ICS)

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.

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"


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

Thanks

Regards.

Answer

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"