解决方案 »

  1.   

    AsyncTask 这个里面启动了一个线程,如果把这个东西再放到一个线程里面 就等于2个线程了。
    线程id就不一样了 
      

  2.   

    你放在子线程里启动是错误的,AsyncTask是辅助用来后台执行,然后更新UI的,只能在UI线程下启动Threading rules
    There are a few threading rules that must be followed for this class to work properly:The AsyncTask class must be loaded on the UI thread. This is done automatically as of JELLY_BEAN.
    The task instance must be created on the UI thread.
    execute(Params...) must be invoked on the UI thread.
    http://developer.android.com/intl/zh-cn/reference/android/os/AsyncTask.html
      

  3.   

    多谢,知道原因了,但是onPreExecute这个方法的API 说明有点不准确啊
      

  4.   

    应该是创建AsyncTask并启动没有在主线程中,只有这样才能对后续的onPostExecute()对UI进行操作。如需了解更多地关于AsyncTask,可以看看这篇文章http://droidyue.com/blog/2014/11/08/bad-smell-of-asynctask-in-android/