I am using the AlertDialog.Builder in Android to quickly prompt the user for text. The dialog shows up and works great, but the user must click on the EditText field to load th
use a custom view if you need it more often
public class RequestFocusEditText extends AppCompatEditText {
private RequestFocusEditText self;
public RequestFocusEditText(final Context context, AttributeSet attrs) {
super(context, attrs);
this.self = this;
setOnFocusChangeListener(new OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
post(new Runnable() {
@Override
public void run() {
InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(self, InputMethodManager.SHOW_IMPLICIT);
}
});
}
});
requestFocus();
}
}