0

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.

Amt87
  • 5,493
  • 4
  • 32
  • 52

1 Answers1

3

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

Community
  • 1
  • 1
waqaslam
  • 67,549
  • 16
  • 165
  • 178
  • is it a problem only with a specific model of galaxy tab? did you try any other tablet? – waqaslam Oct 16 '12 at 07:13
  • Yes it is as I mentioned above, actually I didn't use another tablet, also the edited answer by you has been used, thank you for your prompt response but unfortunately I don't know what is the problem – Amt87 Oct 16 '12 at 08:21
  • 1
    then it seems to be a problem with that specific version of ROM in your tab – waqaslam Oct 16 '12 at 08:50