asyncTask.executehtml
Android.os.Build.VERSION_CODES.DONUT, this was changed to a pool of threads allowing multiple tasks to operate in parallel. After android.os.Build.VERSION_CODES.HONEYCOMB, it is planned to change this back to a single thread to avoid common application errors caused by parallel execution. If you truly want parallel execution, you can use the executeOnExecutor version of this method with THREAD_POOL_EXECUTOR; however, see commentary there for warnings on its use.
This method must be invoked on the UI thread.必須UI線程中調用
android注意:這個函數讓任務是以單線程隊列方式或線程池隊列方式運行,依賴於平臺版本而有所不一樣。asyncTask首次引入時,這個函數會讓任務之後臺單線程串行方式執行。從android.os.Build.VERSION_CODES.DONUT(android 1.6)開始,它讓容許任務在線程池中多任務並行執行。但在 android.os.Build.VERSION_CODES.HONEYCOMB(android 3.0)以後,它又該回去了,變成了單線程執行的模式,緣由是多線程並行執行容易引起問題。若是你真想並行執行任務,你可使用另一個版本:使用THREAD_POOL_EXECUTOR參數的executeOnExecutor方法,但要注意使用警告提示多線程
anyncTask.executeOnExecutorapp
This method is typically used with THREAD_POOL_EXECUTOR to allow multiple tasks to run in parallel on a pool of threads managed by AsyncTask, however you can also use your own Executor for custom behavior.
Warning: Allowing multiple tasks to run in parallel from a thread pool is generally not what one wants, because the order of their operation is not defined. For example, if these tasks are used to modify any state in common (such as writing a file due to a button click), there are no guarantees on the order of the modifications. Without careful work it is possible in rare cases for the newer version of the data to be over-written by an older one, leading to obscure data loss and stability issues. Such changes are best executed in serial; to guarantee such work is serialized regardless of platform version you can use this function with SERIAL_EXECUTOR.
This method must be invoked on the UI thread.
Parameters:
exec The executor to use. THREAD_POOL_EXECUTOR is available as a convenient process-wide thread pool for tasks that are loosely coupled.
less
這個方法一般和THREAD_POOL_EXECUTOR一塊兒使用,容許多個任務在由AsyncTask管理的線程池中並行執行,可是您你也可使用自定義行爲的Executor。async
警告:由於執行操做順序並未定義,一般狀況下,容許多個任務在線程池中並行執行,其結果並不是是你想要的。例如:這些任務都要去修改某個狀態值(諸如點擊按鈕寫文件),由於沒有肯定的修改順序,舊的修改可能會覆蓋新修改的版本內容,致使不穩定數據丟失而變成一個穩定的問題。所以這種任務最好是串行執行;確保這些任務串行執行而不依賴於平臺版本的方法是,使用SERIAL_EXECUTORide
看了這篇文章,http://blog.csdn.net/hitlion2008/article/details/7983449, 講的挺好
函數
更多解釋:http://blog.csdn.net/guolin_blog/article/details/11711405ui
http://www.cnblogs.com/fotransit/archive/2013/04/17/3025937.html
this