Reputation: 42824
Handler
& Scheduler
What I know::
IN - JAVA(Not Android)
Java
uses JVM
Scheduler
takes care of switching the control back and forth
between main-thread
and the worker-threads
multi-threading
.scheduler
and only he can influence
the scheduler
, JVM
takes care of scheduler
functionalityIN - ANDROID
Android
uses JVM
scheduler
is called a Handler
in androidHandler
through which he
can control the scheduling
of threads
My Questions::
Handler
and scheduler
?handler
in android w.r.t Scheduler
in Java ?Thanks !
Upvotes: 2
Views: 1163
Reputation: 39836
I don't believe your expansions are correct and the two are pretty different. Android is a Java machine and still have a scheduler not accessible to the developer.
Handler holds the "handle" of one specific thread. To the Looper of the thread to be more specific (so only threads that "loops" may have handlers).
The handler allows the developer to request some code to be processed in a specific thread either as soon as possible (using the post method) or after some time (using the postDelayed method).
Note that the methods are called 'post'. That means the code will be posted to the scheduler and the scheduler will actually run the code on the requested thread whenever it is time for that thread to be execute.
PS. I answer that from my mobile, sorry for any misspellings.
Upvotes: 2