1.

Design one Spinier control for displaying list of Country and add another spinner for displaying State based on Country Selection.

Answer»

In Android when we have to perform the long-running operation we can create Async Task to INTENT Service.

In AsyncTask, it will create one background thread where the long-running operation will execute and after task result will update in Main Thread. 

In Intent Service we can also do the operation but it is running in the background and it will not update UI in Main Thread. if you want to DOWNLOAD and cache maps, you may want to call an IntentService so the user doesn't have to be looking at the app for it to download. Likewise, if you're sending data to your server, an IntentService is extremely HELPFUL in this regard because you can start and forget.

As a conclusion, we can say AsyncTask is meant for short tasks that have to COMMUNICATE with the main thread. IntentService is meant for long tasks that don't have to communicate with the main thread.



Discussion

No Comment Found

Related InterviewSolutions