I have a barcode reader that works likes a keyboard when reading a barcode sends the keys and ends with enter.
In my picking app I show an alertDialog to confirm the read of quantities after reading an article barcode but if I read another barcode whit the alertDialog is in display, my app continues catching the input keys... the numbers keys focus the accept button (I don't know why) and the enter accept and close the alertDialog.
Is possible to allow only finger touch to confirm an alertDialog?
Edit: this is my alertdialog code:
public void dialogCantidad(String cantidad, String producto){
TextInputEditText focuss = findViewById(R.id.lectura);
focuss.clearFocus();
AlertDialog.Builder builder = new AlertDialog.Builder(activity_detalle.this);
DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
switch (which){
case DialogInterface.BUTTON_POSITIVE:
focuss.requestFocus();
break;
case DialogInterface.BUTTON_NEGATIVE:
//No button clicked
break;
}
}
};
builder.setMessage(cantidad+" unidades. "+producto).setPositiveButton("Lo tengo, loco", dialogClickListener);
builder.setCancelable(false);
AlertDialog theDialog = builder.create();
theDialog.show();
TextView textView = theDialog.findViewById(android.R.id.message);
textView.setTextSize(60);}