| Start |
|---|
| Thread Example with its description While launching an application firstly main thread is executed. This Main thread handles all the UI concept of application. If we want to run long the task in which we don't need the UI then we use thread for running that task in background. Here is the example of Thread which describes blow: We can create thread by creating the object of Thread which have We can also run the the multiple threads independently, which is known as MultiThreading. This thread also have the functionality of sleep by which the currently executing thread to sleep (temporarily cease execution) for the specified number of time. But sleep throws the InterruptedException So, we have to handle it by using try/catch like this. |
| Updating the UI from a Background Thread It is common to use a background Thread for doing network operations or long running tasks, and then update the UI with the results when needed. This poses a problem, as only the main thread can update the UI. The solution is to use the In this simple example, a Thread is started when the Activity is created, runs until the magic number of |
Read Article
https://develop.horje.com/learn/1434/reference