O teclado não está aparecendo no AlertDialog apenas para telefone
Por que o teclado programável está aparecendo apenas no tablet é um mistério!
Aqui está o código que eu usei.
AlertDialog.Builder builder = new AlertDialog.Builder(CurrentActivityName.this);
builder.setTitle(“Title”);
builder.setMessage(“Message”);
final EditText input = new EditText(CurrentActivityName.this);
builder.setView(input);
builder.setPositiveButton(R.string.allow, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//my code
}
});
builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//my code
}
});
builder.create().show();
Eu sou capaz de resolvê-lousando postDelayed
com umnúmero de milissegundos para publicar umExecutável
input.requestFocus();
input.postDelayed(new Runnable() {
@Override
public void run() {
InputMethodManager keyboard = (InputMethodManager)
getSystemService(Context.INPUT_METHOD_SERVICE);
keyboard.showSoftInput(input, 0);
}
},200);
Atrasos codificados nunca são recomendados porque podem introduzircomportamento imprevisível sobcondições diferentes / dispositivos diferentes.
Estou procurando uma solução estável.