Connecting to The Internet using Background Thread | Android Studio Tutorial

preview_player
Показать описание
🏆 My Online Courses
⭐Discount Coupon: LAUNCH-STEVDZA-SAN

🐱‍👤 Wanna become a member? Join!

📸 Instagram

In this video we are going to connect to the internet and download a source code of a web page using Async Task class. Which means that all the connecting and executing functions will be separated from the Main UI Thread, and executed in a Worker/Background Thread instead!

MORE ABOUT ASYNCTASK
AsyncTask enables proper and easy use of the UI thread. This class allows you to perform background operations and publish results on the UI thread without having to manipulate threads and/or handlers.

An asynchronous task is defined by a computation that runs on a background thread and whose result is published on the UI thread. An asynchronous task is defined by 3 generic types, called Params, Progress and Result, and 4 steps, called onPreExecute, doInBackground, onProgressUpdate and onPostExecute.
Комментарии
Автор

Now asynctask and loader is deprecated, is there any method to handle background like asynctask ? Viewmodel and livedata is for loader what about async task ?

mohanavelk
Автор

It did not occur me to convert a textview static to set its text but I had to code an entire localbroadcast manager to set text of a textview!
Duh!

kilavuzyeminlitercume
Автор

asynctask deprecated method
any alternative please

himprass