If an activity is killed, does the AsyncTask live on?

后端 未结 6 1583
你的背包
你的背包 2021-02-18 15:05

I think I know the answer to this, but does an AsyncTask continue to live on once its calling Activity has been finish()ed?

    protected void onPr         


        
6条回答
  •  迷失自我
    2021-02-18 15:38

    The AsyncTask is tied to a UI thread and if the Activity is finished the async task is canceled.

    [update] - Hackbod's comment below is correct. It should be noted that AsyncTasks are meant to be short lived and as such not worry so much about this issue. An AsycTask is only truly gone when it is completed OR the process is killed which may or may not happen after finish is called.

提交回复
热议问题