Running Android tasks in background threads | 34 | Android Development Tutorial for Beginners



Running Android tasks in background threads | 34 | Android Development Tutorial for Beginners

Running Android tasks in background threads  | 34 | Android Development Tutorial for Beginners

Running Android tasks in background threads | 34 | Android Development Tutorial for Beginners
𝐃𝐨𝐧𝐚𝐭𝐞 𝐨𝐫 𝐁𝐮𝐲 𝐦𝐞 𝐂𝐮𝐩 𝐨𝐟 𝐂𝐨𝐟𝐟𝐞𝐞 : https://paypal.me/codingpursuits

so hello guys welcome back. in this video, We are going to learn about the threading in Android application. So stay tuned and watch the video till the end.

so by default Android application completes its task and functionality in a single process or thread. It is also called the main thread. Usually the tasks and the functionalities are very smaller and it completes within no time. but suppose a case in which the task is length example Android application have to download a very large file. so if we are going to to download the file in the single thread or main thread the all functionality will be halted. because Android application will have to work to download file first and then perform next task like you want to type or you want to to go to another screen you cannot go to another screen because Android application is easy to download file so after downloading that file you will be able to perform the next task like navigating to another screen or order something.

So we do not want an application to freeze or halted at this moment we want smooth User experience. So to handle this case we start another process or thread which is also called background thread because it is running in the background and we allocate it the responsibility to download file. Meanwhile, the main thread will give the user the facility to navigate to another screen or to perform other actions so when the download file is completed our background thread will notify us that the file is downloaded and the background thread will be finished and we will notify the user that his his file or task is completed in thread handler. this mechanism is called background threading. so we can run one or multiple threads in Android application and allocate our length or time consuming task to these processes or thread.

Now that’s come towards the treads handler, so when our process completes its task ok it will send a message to the thread Handler so that we can be able to take specific decision or update UI according to the the message sent by the threads. this we override called Handle message so now let’s send a message upon completion the task and display it in the textview we just have created

background thread android
background thread in android example
kotlin background thread
background threading
run service in background thread android
run on background thread android kotlin
how to run background service continuously in android
android background task
asynctask android
android executor example
android handler
android thread example
Android Development
Android Development Tutorial for Beginners

https://youtu.be/IVFWC0rwfL4

Comments are closed.