I have an AlertDialog that appears once a button is clicked, and placed there an EditText I want the user to fill with alphanumerics characters. If it wasn't dynamically created and put in the xml file I would have set something like android:digits="abcdefghijklmnopqrstuvwxyz1234567890 "
. Does anyone know how could I proceed?
My code is this:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Insert text");
final EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_TEXT);
builder.setView(input);
builder.setPositiveButton("CREATE", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//do something
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();