Skip to content Skip to sidebar Skip to footer

How Do I Prevent The Software Keyboard From Popping Up?

I have my own keypad in my application so I want to hide the software keyboard all the time(in specific activities & dialogs). I experimented with two options: getWindow().setS

Solution 1:

Finally figured out!

I used

public void supressKeyboard() {
    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 
}

for the activities where I want to suppress the keyboard(you can put it in a general activity where all other activities inherit from)

But this won't prevent the keyboard from popping up when you click on the EditText textbox. What I did is I consumed the onTouch event for the text box:

@OverridepublicbooleanonTouchEvent(MotionEvent event) {
    returntrue;
}

Post a Comment for "How Do I Prevent The Software Keyboard From Popping Up?"