Amt87
Amt87

Reputation: 5607

How to hide Keyboard when starting activity on Galaxy tab?

I am using galaxy tab with Android 3.1, I am trying to start activity with EditText inside its layout file, but the problem is that each time I enter the activity the keyboard is automatically shown. I don't want the keyboard to be shown except when I click the EditText.

I used many solutions, all of them worked for many android devices except my Galaxy Tab.

Upvotes: 0

Views: 1002

Answers (1)

waqaslam
waqaslam

Reputation: 68177

Set the following to your activity inside AndroidManifest.xml

android:windowSoftInputMode="stateHidden"

Or in onCreate of your activity's code:

getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

Or try adding the following to your onResume()

try {
    InputMethodManager inputManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    inputManager.hideSoftInputFromWindow(this.getCurrentFocus().getWindowToken(), 0);
}
catch (Exception e) { /* do nothing */ }

For more info, read this

Upvotes: 3

Related Questions