Course Content

Course Content

Description

Async Task with Example in Android

In this Video tutorial we will see most useful concept with example in Android About Async Task

It is a very useful concept and the Android application runs on a single thread when launched.

Due to this single thread model, tasks that take a long time to fetch the response can make the application non-responsive.

To avoid this kind of particular situation, we use Async task in android to perform the heavy tasks in the background on a dedicated thread and passing the results back to the UI thread.

Basic methods used in an Async task in Android

Do In Background(): This method contains the code which needs to be executed in the background. In this method, we can send we can send requests multiple times to the UI thread by publishProgress() method. To notify that the background processing has been completed we just have to use the return statements.

On Pre Execute(): This method contains the code which is executed before the background processing starts.

On Post Execute(): This method is called after doinBackground method completes processing. The result from doinBackground is passed to this method.

onProgressUpdate(): This method receives progress updates from doInBackground method, which is published via publishProgress method, and this method can use this progress update to update the UI thread.

Android Asynctask Example

  • Downloading multiple files
  • Uploading multiple files and images
  • Communicate with server

FAQs

Recommended Courses

Share With Friend

Have a friend to whom you would want to share this course?

Download LearnVern App

App Preview Image
App QR Code Image
Code Scan or Download the app
Google Play Store
297K+ Downloads
App Download Section Circle 1
4.5 Rating
App Download Section Circle 2
10K+ Reviews
App Download Section Circle 3
  • Learn anywhere on the go
  • Get regular updates about your enrolled or new courses
  • Share content with your friends
  • Evaluate your progress through practice tests
  • No internet connection needed
  • Enroll for the webinar and join at the time of the webinar from anywhere