On the long run, AsyncTask produces a memory leak : if the AsyncTask lasts for long, it keeps the activity "alive" whereas Android would like to get rid of it as it can no longer be displayed. The activity can't be garbage collected and that's a central mechanism for Android to preserve resources on the device.
Does that means that if we call finish()
method and asynctask is running then also activity will remain "alive"?If not,then what does this means
if the AsyncTask lasts for long, it keeps the activity "alive"?
Activity will be alive unless we call finish()
method or we press back button.Does this mean that if asyntask is running then activity will be alive even after that?