Jason
Jason

Reputation: 231

Phones with external keyboard. Prevent change orientation

I have a big issue for those phones that have not only the softkeyboard that all phones have (on screen)... i'm talking about those phones with external keyboard hardware.

in these moment I've set all activities, forcing one way, portrait. Now here comes the problem when the user flips his external keyboard, the activity changes orientation forcing the app to close.

if someone dosn't know which phones i'm talking about here is an example: Phone with external keyboard

Piece of my manifest;

<activity
      android:name=".Splash"
      android:label="@string/app_name"
      android:noHistory="true"
      android:screenOrientation="portrait"
      android:theme="@android:style/Theme.NoTitleBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
</activity>

<activity
     android:windowSoftInputMode="stateHidden"
     android:name=".MainActivity"
     android:screenOrientation="portrait"
     android:theme="@android:style/Theme.NoTitleBar" >
</activity>

How can make the keyboard to ignore orientation?

Upvotes: 0

Views: 148

Answers (1)

D.Bish
D.Bish

Reputation: 208

Try adding this to your activity manifest.

android:configChanges= "keyboardHidden|orientation"

Upvotes: 1

Related Questions