EditText Keyboard is dissappearing
I have an EditText
and 开发者_如何学Goa Button
in LinearLayout. When clicked to button, I am removing all views in layout and adding another view. When back button is pressed I am removing all views and adding editText and Button again. Now when I touch on editText, keyboard does not become visible! I think maybe it is a focus issue. How can handle this problem?
Try this code, it will work for you.
InputMethodManager m = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
if(m != null){
m.toggleSoftInput(0, InputMethodManager.SHOW_IMPLICIT);
}
show keyboard using
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
精彩评论