4
Guys, I have a problem with my alert:
In it I have an Edittext, only I can’t declare Edittext with type numbers(android:inputType="number"). Any idea?
Follow the code of the Alert:
public void exibirMensagemEdt(String titulo, String texto){
    AlertDialog.Builder mensagem = new AlertDialog.Builder(TelaCardapio.this);
    mensagem.setTitle(titulo);
    mensagem.setMessage(texto);
    // DECLARACAO DO EDITTEXT
    final EditText input = new EditText(this); 
    mensagem.setView(input);
    mensagem.setNeutralButton("OK", new DialogInterface.OnClickListener() {
        public void onClick(DialogInterface dialog, int which) {
            Toast.makeText(getApplicationContext(), input.getText().toString().trim(),
                    Toast.LENGTH_SHORT).show();
        }
    });
    mensagem.show();
     // FORÇA O TECLADO APARECER AO ABRIR O ALERT
     InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
     imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
}
						
If I’m not mistaken, just use the method
setRawInputTypein your Edittext instance.– Wakim