Android Developer Question:
Tell us difference between Service, Intent Service, AsyncTask & Threads?
Answer:
☛ Android service is a component that is used to perform operations on the background such as playing music. It doesn’t has any UI (user interface). The service runs in the background indefinitely even if application is destroyed.
☛ AsyncTask allows you to perform asynchronous work on your user interface. It performs the blocking operations in a worker thread and then publishes the results on the UI thread, without requiring you to handle threads and/or handlers yourself.
☛ IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand. Clients send requests through startService(Intent) calls; the service is started as needed, handles each Intent in turn using a worker thread, and stops itself when it runs out of work.
☛ A thread is a single sequential flow of control within a program. Threads can be thought of as mini-processes running within a main process.
☛ AsyncTask allows you to perform asynchronous work on your user interface. It performs the blocking operations in a worker thread and then publishes the results on the UI thread, without requiring you to handle threads and/or handlers yourself.
☛ IntentService is a base class for Services that handle asynchronous requests (expressed as Intents) on demand. Clients send requests through startService(Intent) calls; the service is started as needed, handles each Intent in turn using a worker thread, and stops itself when it runs out of work.
☛ A thread is a single sequential flow of control within a program. Threads can be thought of as mini-processes running within a main process.
Previous Question | Next Question |
What is difference between Serializable and Parcelable? | Tell me two ways to clear the back stack of Activities when a new Activity is called using intent? |