What is the difference between View.postDelayed() and Handler.postDelayed() on the main thread?

前端 未结 1 1914
抹茶落季
抹茶落季 2021-01-01 20:25

According to the documentation of Handler.postDelayed(Runnable r, long delayMillis):

Causes the Runnable r to be added to the message que

相关标签:
1条回答
  • 2021-01-01 21:00

    From the source, View.postDelayed() is simply using Handler.postDelayed() on an internal handler so there is no difference.

    foo() may leak the Activity, you should use View.removeCallbacks() to minimize this chance.

    0 讨论(0)
提交回复
热议问题