1

On an activity I have two EditText. One that must not show the Android Keyboard and an other that must show it. I have already tried to implement the following code to show the keyboard:

EditText txtName = (EditText) findViewById(R.id.txtName);
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(txtName, InputMethodManager.SHOW_IMPLICIT);

Also I have tried a lot of other examples that I found.

1 Answer 1

0

Try this:

InputMethodManager imm = (InputMethodManager)this.getSystemService(Service.INPUT_METHOD_SERVICE);

For show:

imm.showSoftInput(ed, 0);

For Hide

imm.hideSoftInputFromWindow(ed.getWindowToken(), 0); 
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.