6

As i read in the android annotations for thread document

We have four types of thread,

  • @MainThread
  • @UiThread
  • @WorkerThread
  • @BinderThread

What is differences?

AliSh
  • 10,085
  • 5
  • 44
  • 76

1 Answers1

10

The differences is:

  • @MainThread, first Thread run when app started,
  • @UiThread, run from MainThread for UI works,
  • @WorkerThread, that run when programmer define a thread
  • @BinderThread,uses for something like query()/insert()/update()/delete() methods in ContentProvider.
AliSh
  • 10,085
  • 5
  • 44
  • 76
  • 4
    There is one and only one main thread in the process. That's the MainThread. That thread is also a UiThread. This thread is what the main window of an activity runs on, for example. However it is also possible for applications to create other threads on which they run different windows. This will be very rare; really the main place this distinction matters is the system process. Generally you'll want to annotate methods associated with the life cycle with MainThread, and methods associated with the view hierarchy with UiThread. – marciowb May 16 '16 at 17:43