We called requestFocus
to focus on EditText
automatically but sometimes it works or it doen't work. so we added the runnable to UI thread to focus on it.
view.post(new Runnable() {
@Override
public void run() {
view.requestFocus();
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(view, InputMethodManager.SHOW_FORCED);
}
});
Finally we know it works well but I'm really curious of the reason. Why? Is there anyone who knows it?