What is the difference between Handler vs AsyncTask vs Thread?

Technology CommunityCategory: AndroidWhat is the difference between Handler vs AsyncTask vs Thread?
VietMX Staff asked 3 years ago
  • 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:
  • Handle synchronization with the main thread if you post back results to the user interface
  • No default for canceling the thread
  • No default thread pooling
  • No default for handling configuration changes in Android