hi everyone, I have this method which is being use...
# android
d
hi everyone, I have this method which is being used inside Recycler view view holder. I am using this method inside view holders bind method. It is causing ANR. How to solve this
Copy code
private fun timer(
        millisInFuture: Long,
        countDownInterval: Long
    ): CountDownTimer? {
        countDownTimer = (object : CountDownTimer(millisInFuture, countDownInterval) {
            override fun onTick(millisUntilFinished: Long) {
                val timeRemaining = timeString(millisUntilFinished)
                binding.btnAuctionTimer.visibility = View.VISIBLE
                binding.btnAuctionTimer.text = timeRemaining
            }

            override fun onFinish() {
                binding.btnAuctionTimer.visibility = View.INVISIBLE

            }
        }).start()
        return countDownTimer
    }