Is there a link to View.postDelayed for Android?

I wonder if the runnable passed in View.postDelayed will be automatically deleted when the view is separated from the parent.

I looked at the source of the View class, and it was sent to some Handler , which it goes beyond. But the life cycle of this handler is not clear.

Does anyone know the answer?

+5
source share
1 answer

I wonder if the runnable passed to View.postDelayed will be automatically deleted when the view is separated from the parent.

It will be executed after the completion of the method. If you have an infinite loop in it, it will never be deleted, and therefore you will leak the view, and the Activity that uses this view

+2
source

Source: https://habr.com/ru/post/1259030/


All Articles