Code ANDROID

private void payTransaction() {
       
            Thread thread = new Thread() {
                @Override
                public void run() {
                    try {

                        // Creating an ArrayList of String
                        ArrayList transaction_deposits;
                        ArrayList transaction_dispensed;                                                            

                        //payTransaction
                        RequestStatus statusPayTransaction = new CashRecycler().payTransaction(
                                new BigDecimal(findViewById(R.id.payTrasactionInput).getText().toString()),             // Amount
                                "EUR"                                                                                   // Currency
                        );

                        if (! statusPayTransaction.isValid()) {                                              

                            //Show rest to dispense
                            BigDecimal balance = (BigDecimal) statusPayTransaction.getResult()
                                    .getFieldValues()
                                    .get(PayTransaction.TRANSACTION_AMOUNT_BALANCE.getId());

                            updateSubTitle("Can't pay : " + statusPayTransaction.getErrorMessage() + "\n" + "Rest to dispense: " + balance);
                        }
                    } catch (InterruptedException | InstantiationException | IllegalAccessException | ServerException exception) {
                        updateSubTitle(" exception : " + exception.getMessage());
                    }
                }
            };

            thread.start();
            }