How handler classes work in Android

前端 未结 3 1035
醉酒成梦
醉酒成梦 2020-12-23 10:20

I am new to android and was reading the demo applications on official android website. And I came across a method of Handler class named as postDelayed(Ru

3条回答
  •  臣服心动
    2020-12-23 11:00

    postDelayed (Runnable r, long delayMillis)

    Causes the Runnable r to be added to the message queue, to be run after the specified amount of time elapses. The runnable will be run on the thread to which this handler is attached.

    • Runnable Represents a command that can be executed.

    • delayMillis represents the time after which it should be executed.

    Basically, it delays the execution of command(some code maybe) for particular period of time (delayMillis), so as to execute the command after specified time.

提交回复
热议问题