I am using AlertDialog.Builder in order to create an input box, with EditText as the input method.
Unfortunately, the Soft Keyboard doesn\'t pop, al
When you call showDialog()
to show a Dialog created using AlertDialog
in onCreateDialog()
You should put the code in onPrepareDialog()
:
@Override
protected void onPrepareDialog (int id, Dialog dialog, Bundle args)
{
TextView editText=(TextView) dialog.findViewById(R....);
editText.setOnFocusChangeListener(new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
if (hasFocus) {
dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
}
}
});
}