Explained - Android AsyncTask

preview_player
Показать описание
Dive into the essentials of Android development with our comprehensive tutorial on AsyncTask and multi-threading techniques. This video is designed for both newcomers and seasoned developers looking to enhance their understanding of Android's powerful background processing capabilities. Learn how to efficiently perform long-running tasks without hindering the UI thread, ensuring your applications run smoothly and responsively.

Discover the four crucial methods of AsyncTask: `onPreExecute`, `doInBackground`, `onPostExecute`, and `onProgressUpdate`, and understand their roles in executing background tasks and updating the UI seamlessly. Through practical examples, this tutorial demonstrates how to initiate a task, process data in the background, and reflect the outcomes on the UI without causing delays or crashes.

Whether you're aiming to improve your app's performance or seeking to grasp Android's concurrency framework, this video offers valuable insights into using AsyncTask effectively. Follow along as we explore how to start and stop tasks, manage thread execution, and handle UI updates with ease.

Join us on this learning journey to master the art of multi-threading and AsyncTask in Android development.

#AndroidDev #AsyncTask #MultiThreading #BackgroundProcessing #UIUpdate #AppDevelopment #AndroidProgramming

0:00 - Introduction to AsyncTask and Multi-threading Concepts
0:48 - Overview of AsyncTask API and Its Four Key Methods
1:09 - Utilizing doInBackground for Background Tasks
2:01 - Preparing and Finalizing Tasks with onPreExecute and onPostExecute
3:03 - Updating UI in Real-Time with onProgressUpdate
6:18 - Starting and Stopping AsyncTask in Practice
Рекомендации по теме
Комментарии
Автор

0:35 AsyncTask introduction
1:10 AsyncTask methods breakdown
2:29 AsyncTask demo
2:52 coding of inner class MyAsyncTask
private class MyAsyncTask extends AsyncTask <Integer, Integer, Integer> {

}
5:55 MyAsynTask codes
6:03 execution of MyAsyncTask
MyAsyncTask myAsyncTask = new MyAsyncTask();
myAsyncTask.execute(count);
7:08 another way of exciting Async Task :
myAsyncTask.Cancel(true);

freshfast
Автор

I know we use threads mostly while working in UI but I always wondered how do we use threads on UI . But this series totally cleared my doubt and shown me how important the uses of threads are !! As always awesome Teaching

saravananm
Автор

Sir this is the best video I watched for asyncTask.. The best explanation ever

krishnarawal
Автор

Writing the current Thread number to the Console might help to further understand this class.
Great explanation, though! Thanks

DavidH
Автор

Great tut man !!! Have watched the start and makes pretty much sense

sachinshinde
Автор

Awesome tutorial as usual.

But you should use static inner class for your AsyncTask to prevent memory leaks. As non static inner classes holds an implicit reference to their outer class and won't allow the outer class to get garbage collected until that inner class have finished its execution, which will cause memory leaks.

CuiqkOfficial
Автор


A task can be cancelled at any time by invoking cancel(boolean). Invoking this method will cause subsequent calls to isCancelled() to return true. After invoking this method, onCancelled(Object), instead of onPostExecute(Object) will be invoked after doInBackground(Object[]) returns. To ensure that a task is cancelled as quickly as possible, you should always check the return value of isCancelled() periodically from doInBackground(Object[]), if possible (inside a loop for instance.)

BuffaloCanCode
Автор

Awesome tut sir,  I like your explaination of the topic.

GeekyGagan
Автор

Wow it's really well and easy explained. How i missed this channel???

redleafsofts
Автор

Sir, I am using AsyncTask for chat application using socket. I created server in python and client in android. I am connecting and sending a message to the server in doInBackGround(). The problem I am facing is I could only connect and send message for single time to the server. The server does not accept my second message from the client. Can you suggest some tips to overcome this problem? Many thanks in advance.

maulikmadhavi
Автор

wow... a pilot voice giving programming tutorials

groinache
Автор

It's a superb demo
Need a last statement clarification
i.e. once asyc task is cancelled we can't start again
Can you please elaborate this little bit more

niteshaddanki
Автор

Hope to make the voice more clear thanks

hendibrahim
Автор

Great Explanation - a simple way with in a small period of time :) Thanks for upload:)

rameshp
Автор

Please make video on kotlon coroutines

rishadbaniya
Автор

please make a real world app where we can apply thread

mimrankhan
Автор

While running the code:
Caused by: java.lang.ClassCastException: java.lang.Object[] cannot be cast to java.lang.Integer[]
What to do now? :(

AvinashRavi
Автор

Hi,
Thanks a lot for ur tutorial.You have kept Thread.Sleep() Inside doInBackground().Which Thread it will take?

kavie
Автор

kindly guide to make FTP CLIENT APP TO UPLOAD FILES ON SERVER

asgharali-mnmx
Автор

Great explanation, but the sound is terribly recorded

aghiadalzein