I created Linear Layout with two custom views.
class myView1(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
...
override fun onDraw(canvas: Canvas?){..}
}
class myView2(context: Context?, attrs: AttributeSet?) : View(context, attrs) {
...
override fun onDraw(canvas: Canvas?){..}
}
I have button. I would like to have situation like this:
- If button clicked: start loop which will be calling onDraw every second (refreshing View every second)
- If button clicked once again: break the loop.
I was trying by .invalidate(), but it didn't work.
How can I call create that loop?