When a user opens an application android operating system creates a process or a thread of execution of commands called the main Thread or the ui thread . The main thread is nothing but handler thread .The main thread is responsible for handling events from all over the apps . Any piece of java code is that needs to be exwcuted are pushed and serviced by the Main Thread .The main is thread is doing most of the stuff so its better to use multiple thread other than the ui thread or main thread.
A thread is the path followed when executing a program .The jvm allows and application to have multiple threads of execution running parralell . So multple path of programs can executed in paraalel .so as to bring the results or returns of methods to the Main Thread
We can perform any task in multiple threads but as far as Updating the userinteface or anything updating the main thread is concerned we cant do it unless we have handlers in that thread that will tell the Main Thread about the updates or data .
A video will be uploaded soon with the attachment
No comments:
Post a Comment