user754730
user754730

Reputation: 1340

configChanges not recognized by TabHost?

I have a pretty big problem with my TabHost. Although I have declared all of my Activities (Including my TabHost Activity) to ignore orientation and keyboardHidden, if I flip my Phone (Android 4.0) It still recreates the activity.

Here is a shortened version of my Manifest:

<application
    android:icon="@drawable/icon"
    android:label="@string/app_name" >
    <uses-library android:name="com.google.android.maps" />

    <activity
        android:name=".TabHost"
        android:configChanges="orientation|keyboardHidden"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".Activity1"
        android:configChanges="orientation|keyboardHidden"
        android:label="@string/app_name" />
    <activity
        android:name=".Activity2"
        android:configChanges="orientation|keyboardHidden"
        android:label="@string/app_name" />
    <activity
        android:name=".Activity3"
        android:configChanges="orientation|keyboardHidden"
        android:label="@string/app_name" />
</application>

I don't think that the code of the activities would help?!
If it would however, let me know and I'll post it too.


Kind regards

Upvotes: 0

Views: 418

Answers (1)

Mayank
Mayank

Reputation: 8852

if you are trying to stop the rotation of the screen use following code in your AndroidManifest.xml for each activity.

android:screenOrientation="nosensor"

UPDATE

According to API when using android:configChanges="orientation|keyboardHidden"

"orientation"

The screen orientation has changed — the user has rotated the device. Note: If your application targets API level 13 or higher (as declared by the minSdkVersion and targetSdkVersion attributes), then you should also declare the "screenSize" configuration, because it also changes when a device switches between portrait and landscape orientations.

so, if you are targeting API level 13 or higher you gotta specify screen size also.

Upvotes: 3

Related Questions