0 votes
in Android by
What is the difference between Handler vs AsyncTask vs Thread?

1 Answer

0 votes
by

The Handler class can be used to register to a thread and provides a simple channel to send data to this thread. A Handler allows you communicate back with the UI thread from other background thread.

The AsyncTask class encapsulates the creation of a background process and the synchronization with the main thread. It also supports reporting progress of the running tasks.

And a Thread is basically the core element of multithreading which a developer can use with the following disadvantage:

  1. Handle synchronization with the main thread if you post back results to the user interface
  2. No default for canceling the thread
  3. No default thread pooling
  4. No default for handling configuration changes in Android

Related questions

0 votes
asked Jun 17, 2022 in JAVA by sharadyadav1986
0 votes
0 votes
asked Sep 13, 2023 in Operating System by rajeshsharma
...