I believe Google suggests developers to use AsyncTask. However, I would like to know how is it different from using \'new Thread\' and then calling \'RunOnUiThread\' in perf
These are HUGELY different.
AsyncTask is designed for short spurts of dedicated activity, such as downloading a file or uploading some data.The only reason you want to run something in the UI thread is to interact with widgets. Other than that, if you want to do long processing, use an AsyncTask.
Edit:
You could download your data in a separate thread, and I have no issues with that. The problem comes when you want to update the UI. Alone, it is impossible to modify the UI from a child thread. Instead, you will have to create either a handler tied to the UI thread or create a new thread that is destined to run in the UI thread (as in your example). This is not only tedious, but a tragic waste of resources. The AsyncTask takes care of this simply and efficiently.
To address your last point, you are correct. The AsyncTask does have access to the main thread in pre/postExecute. However, the processing (the primary source of the UI lag) that the task is preforming is not. With the Task, the UI will only be impacted based on what you are drawing, as opposed to having to wait for the Task to finish its job and whatever drawing it wants to do.