I have an EditText
and a Button
. On click of the button i want to open the EditText
keyboard and at the same time request focus on the
As an extension to this answer (I didn't add it as a comment because of reputation...).
If you want to reduce the delayed time to zero, use handler.post() instead. Full code:
final Handler handler = new Handler();
handler.post(new Runnable() {
@Override
public void run() {
lastview.getEditText().clearFocus();
m_SearchEditText.requestFocus();
InputMethodManager mgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(mLastNameET, InputMethodManager.SHOW_IMPLICIT);
}
});