Android Level Difference

How b / w runnable works inside the new Handler () handler. post (runnable) and works in Thread (runable)?

+4
source share
2 answers

Handler.post() is Runnable in the main thread of the application. new Thread() creates a new thread.

-2
source

Handler used for communication between coordinating threads. By creating a Handler, you bind it to the current thread. If you send runnable to this handler, it will execute in the same thread.

Thread is a Java way to create new user level threads. The run that you will pass will be performed in this thread.

Both concepts are not mutually exclusive. You can use Handler with custom Thread s.

+11
source

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


All Articles