Kotlin Android debounce

前端 未结 10 853
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-05 11:07

Is there any fancy way to implement debounce logic with Kotlin Android?

I\'m not using Rx in project.

There is a way in Java, but it is too big

10条回答
  •  长情又很酷
    2020-12-05 11:15

    You can use kotlin coroutines to achieve that. Here is an example.

    Be aware that coroutines are experimental at kotlin 1.1+ and it may be changed in upcoming kotlin versions.

    UPDATE

    Since Kotlin 1.3 release, coroutines are now stable.

提交回复
热议问题