What is the difference between AsyncTask and Thread/Runnable?

Technology CommunityCategory: AndroidWhat is the difference between AsyncTask and Thread/Runnable?
VietMX Staff asked 3 years ago
  • AsyncTask is a convenience class for doing some work on a new thread and use the results on the thread from which it got called (usually the UI thread) when finished. It’s just a wrapper which uses a couple of runnables but handles all the intricacies of creating the thread and handling messaging between the threads. AsyncTask is designed to be a helper class around Thread and Handler and does not constitute a generic threading framework.
  • The Runnable interface is at the core of Java threading. The Runnable interface should be implemented by any class whose instances are intended to be executed by a thread.