0

I'm programming in Kotlin and using Firebase as DB.

My aim is to write all the dates and their respective content in a listView however it has to be from the most recent to the oldest date.

In the image is an arrow showing which date should appear first

TY for your time

enter image description here

There is the code that read the input and send data to DB

            val numeroOrigem = binding.meuNumero.text.toString()
            val numeroDestino = binding.editTextNumber2.text.toString()
            val saldo = binding.editTextNumberDecimal2.text.toString()

            database = FirebaseDatabase.getInstance().getReference("Historico")
            val data = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:sss'Z'")
            val currentDate = data.format(Date())
            val DataTransfer = DataTransfer(numeroOrigem,numeroDestino ,saldo)
            database.child(numeroOrigem).child(currentDate).setValue(DataTransfer)
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Jon Parker
  • 11
  • 1

0 Answers0