when using AlertDialog.Builder with EditText, the Soft Keyboard doesn't pop when using AlertDialog.Builder with EditText, the Soft Keyboard doesn't pop android android

when using AlertDialog.Builder with EditText, the Soft Keyboard doesn't pop


I've made such a thing

AlertDialog.Builder b = new AlertDialog.Builder(this);//....AlertDialog dialog = b.create();dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);dialog.show();


I've managed to solve it like this:

Dialog = builder.create();Dialog.show();Dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE  | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);Dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);


I found out that the same code works properly on Tablet, the keyboard does pop up, but on Phone it doesn't, so researching further, seems to point to the "adjust" option.

I am using this, feels much cleaner.

AlertDialog d = builder.create();d.getWindow().setSoftInputMode(    WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);d.show();