How can i fix" Button().isEnabled" error on my app?

how to fix
how to fix anything
how to repair appliances
how to fix things around the house
how to fix broken things
how to fix a computer
how to fix a zipper
how to fix phone

I'm trying to make an RNG App and want to disable my Button as long as my animation is running. It shouldn't be too complicated, because I'm a Beginner in Kotlin-App development. it crashes after the delay.

I have already tried other ways with my Animation and is tried setEnable().

button_randomize.setOnClickListener {
    textView_Number.text = (minRangeRandom..maxRangeRandom).shuffled().first().toString()

    Timer().schedule(object: TimerTask(){
         override fun run() {
             button_randomize.isEnabled = false
    button_randomize.isEnabled = true

I expect that the randomize Button is disabled until the animation is finished. Currently, it crashes when the delay is finished.

It's likely because Timer creates a new thread, and your TimerTask is ran on that new thread. However, the Android UI framework does not support multi-threading. View properties may only be altered on the main thread.

To fix this, use a different way to delay. This executes the delayed code on the main thread:

button_randomize.isEnabled = true
    button_randomize.isEnabled = false
}, 500)

How to Fix Everything, Umbra visits the Fixers' Collective in Brooklyn, a social experiment in improvisational fixing Duration: 2:53 Posted: Mar 9, 2010 is a one-stop source for fixing products in and around your home. Millions of quality OEM replacement parts, repair videos, instructions, and same-day shipping available!

Try below code.

    .withStartAction {
        button_randomize.isEnabled = false
    }.withEndAction {
        button_randomize.isEnabled = true     

5 Ways To Fix YouTube, Click here to Tweet the CEO of YouTube ➡ Subscribe For More Videos ➡ Duration: 10:35 Posted: Mar 21, 2016 Automatically Repair Windows 7 or Windows Vista . Windows 7 and Windows Vista have nearly identical processes for automatically repairing important files. This process is called Startup Repair and functions similarly to the Startup Repair in Windows 10 & Windows 8 in that it only fixes problems related to Windows starting properly.

You can add an animator listener to know when it ends, like this

textview_Number.animate().setDuration(500).rotationBy(360f).setListener(object : Animator.AnimatorListener {
                override fun onAnimationRepeat(animation: Animator?) {}

                override fun onAnimationCancel(animation: Animator?) {}

                override fun onAnimationStart(animation: Animator?) {}

                override fun onAnimationEnd(animation: Animator?) {
                     button_randomize.isEnabled = true

28 HACKS TO FIX ANYTHING QUICKLY, how to unscrew a rusty screw, how to drill a hole in the wood, and other tricks that will facilitate Duration: 9:51 Posted: Nov 10, 2018 iFixit is a global community of people helping each other repair things. Let's fix the world, one device at a time. Troubleshoot with experts in the Answers forum—and build your own how-to guides to share with the world.

100 Home Repairs You Can Do Yourself — The Family Handyman, Fix Holes in Siding. Nail holes in aluminum and vinyl siding are tough to repair without replacing the entire piece, but a squirt of color-matched� HOW TO FIX IT. 5 Ways to Curb Climate Change. Governments, businesses, and utilities are moving toward cleaner energy. But the push to trim carbon emissions begins with changing how we live.

iFixit: The Free Repair Manual, iFixit is a global community of people helping each other repair things. Let's fix the world, one device at a time. Troubleshoot with experts in the Answers� P ress the Windows key, type Network problems, and then select Identify and repair network problems in the list. Follow the steps in the wizard to diagnose and resolve your network problems. Run Windows Update again.

How to fix the most common smartphone problems, Phone problems? You might be able to fix them yourself.Adrien via Unsplash/ Leovinus via Pixabay. No one likes a faulty smartphone. We show you how to fix a sagging headliner. This method works every time and holds the liner up for years. ***** If you would like to help us out.

  • A crash log would have helped..
  • try using View.postDelayed on your button instead of a timer.
  • This is a way to sync the animation with the handler hardcoded, this is by far a not good approach.
  • This doesn't work sadly but thanks for your submission!