Bobbake4
Bobbake4

Reputation: 24857

Hide soft keyboard on tablet not working?

I have an Android application with a few edittext boxes. The issue I am having is that the keyboard pops up on it's own when you open this screen which I don't want. This only happens on tablets, on a phone the keyboard does not show. I have add this code to my onCreate but it makes no difference.

InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);

Any idea why the keyboard would not show on a phone but on a tablet it shows every time?

Upvotes: 2

Views: 984

Answers (1)

Dawid Sajdak
Dawid Sajdak

Reputation: 3084

try to add to your activity in androidmanifest.xml this line: android:windowSoftInputMode="stateHidden"

<activity
        android:label="eMuse"
        android:windowSoftInputMode="stateHidden"
        android:name=".MainClass" >
        <intent-filter >
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Upvotes: 4

Related Questions