Android: Dialog box show soft keyboard automatically when focus is on an EditText not working

馋奶兔 提交于 2019-11-28 13:50:10

What you can do is try using postDelayed(Runnable) for EditText as below,

                ettext.requestFocus();
                ettext.postDelayed(new Runnable() {
                    @Override
                    public void run() {
                        InputMethodManager keyboard = (InputMethodManager)
                        getSystemService(Context.INPUT_METHOD_SERVICE);
                        keyboard.showSoftInput(ettext, 0);
                    }
                },200);
Vishal Arya

Just try adding the below line before "et.setOnFocusChangeListener"

((InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE))
                    .showSoftInput(et, 2);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!