Dropping event (no window focus):KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_0
08:09 02 Dec 2025

I'm developing a app where there are some edittext where i check if the field has 13 digits, because the device is connected with a barcode scanner.

My problem is that with old devices sometimes skips some digits. I debugged and it shows me this message:

W/VRI[MainActivity]: Dropping event (no window focus):KeyEvent { action=ACTION_DOWN, keyCode=KEYCODE_0, scanCode=11, metaState=0, flags=0x8, repeatCount=0, eventTime=1759540858779000, downTime=1759540858779000, deviceId=25, source=0x101, displayId=-1 }

This is the code where i try to check that barcode

eTxt2.addTextChangedListener(new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

    }

    @Override
    public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

    }

    @Override
    public void afterTextChanged(Editable editable) {

        System.out.println(eTxt2.getText() + " - " + eTxt2.getText().length());
        if (eTxt2.getText().length() == 13) {


            if (eTxt2.getText().toString().substring(0,2).equals("80") || eTxt2.getText().toString().substring(0,2).equals("90")) { // si es

                mediaplayerError.start();
                vibrator.vibrate(1000);
                bultoSeleccionado.setText(Html.fromHtml("CÓDIGO DE BARRAS NO VALIDO, PODRÍA SER EL CÓDIGO DE BARRAS DE UNA ORDEN"));
                eTxt2.getText().clear();
            } else if (eTxt2.getText().toString().substring(0,1).equals("6")) {
                mediaplayerError.start();
                vibrator.vibrate(1000);
                bultoSeleccionado.setText(Html.fromHtml("CÓDIGO DE BARRAS NO VALIDO, PODRÍA SER EL CÓDIGO DE BARRAS DE UN PEDIDO"));
                eTxt2.getText().clear();
            } else if (eTxt2.getText().toString().substring(0,2).equals("84"))  {
                eTxt.setText(eTxt2.getText().toString());
                eTxt2.getText().clear();
            } else if (eTxt2.getText().toString().substring(0,1).equals("1") ||
                    eTxt2.getText().toString().substring(0,1).equals("2") ||
                    eTxt2.getText().toString().substring(0,1).equals("3") ||
                    eTxt2.getText().toString().substring(0,1).equals("4") ||
                    eTxt2.getText().toString().substring(0,1).equals("5")){

                        if (ubicacionSeleccionada2 != null) {
                            new obtenerBulto(eTxt2.getText().toString()).execute();
                        }

                        if (ubicacion != null) {
                            eTxt2.getText().clear();
                        }

            } else {
                mediaplayerError.start();
                vibrator.vibrate(1000);
                bultoSeleccionado.setText(Html.fromHtml("CÓDIGO DE BARRAS NO VALIDO"));
                eTxt2.getText().clear();
            }
        }





    }
});
android