1

I know how to use each one of HandlerThread/Thread/ThreadPool/IntentService, But I'm really don't know which one I need to pick to use for background task.

Somebody have some tips when to use each one?

I.Mac
  • 289
  • 3
  • 17

1 Answers1

0
  • You can use HandlerThread/Thread for small background task.

  • Thread pool is used when you have multiple background task like consuming 100 web services, so instead of creating 100 threads and starting all the threads at same time you can use ThreadPool. It will minimize the overhead due to thread creation.

  • IntentService or Service can be used for long running tasks in background.

Ishan
  • 1,172
  • 10
  • 25