-4

My keyboard automatically open when I go to new activity having EditText in it. I have to disable this issue.

  • 1
    Possible duplicate of : http://stackoverflow.com/questions/1555109/stop-edittext-from-gaining-focus-at-activity-startup – M.Waqas Pervez Aug 29 '16 at 12:13
  • 1
    Possible duplicate of: http://stackoverflow.com/questions/4668210/automatic-popping-up-keyboard-on-start-activity?rq=1 – Vladimir Aug 29 '16 at 12:14
  • 1
    you need to stop the auto focusing of edittext, by making some other layout elements auto focusable. refer http://stackoverflow.com/questions/10611833/how-to-disable-keypad-popup-when-on-edittext – Hari Swaminathan Aug 29 '16 at 12:14
  • 3
    Possible duplicate of [How to hide softkeyboad when activity start in android?](http://stackoverflow.com/questions/5990966/how-to-hide-softkeyboad-when-activity-start-in-android) – MurugananthamS Aug 29 '16 at 12:16

5 Answers5

2

you can use windowSoftInputMode for disable your keyboard.

<activity
   android:name="YourActivituy"
   android:screenOrientation="portrait"
   android:windowSoftInputMode="stateHidden"></activity>
Hardik Vaghasiya
  • 298
  • 1
  • 3
  • 11
0

Use this with your activity which contain editText :

<activity
android:name=".MainActivity"
android:label="@string/title_activity_main"
android:configChanges="orientation|screenSize|keyboardHidden"/>
Dipali Shah
  • 3,742
  • 32
  • 47
0

Add this in your Activity onCreate() method where you want to hide the Keyboard

  this.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
Sanoop Surendran
  • 3,484
  • 4
  • 28
  • 49
0

Try this,

InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);
imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0);
Mujammil Ahamed
  • 1,454
  • 4
  • 24
  • 50
0
  1. Use this in AndroidManifest.xml

android:windowSoftInputMode="stateHidden|adjustResize"

  1. Or you can use this on EditText,Shift the focus to the TextView,
    Calling the TextView requestFocus() in the Activity.

android:focusable="true"
android:focusableInTouchMode="true"

KongJing
  • 475
  • 5
  • 7