Best way to perform an action periodically [while an app is running] - Handler?

后端 未结 3 1384
没有蜡笔的小新
没有蜡笔的小新 2021-01-01 22:39

I\'m trying to perform an action periodically. I want to create a new instance of a class after, say, ever 3 seconds. Would it be best to implement this by using a Handler o

3条回答
  •  无人及你
    2021-01-01 23:12

    The simplest thing is to use postDelayed() on a View (e.g., a widget) to schedule a Runnable that does work, then reschedules itself.

提交回复
热议问题