android-runonuithread

Warning: This AsyncTask class should be static or leaks might occur

怎甘沉沦 提交于 2019-11-25 23:26:18
I am getting a warning in my code that states: This AsyncTask class should be static or leaks might occur (anonymous android.os.AsyncTask) The complete warning is: This AsyncTask class should be static or leaks might occur (anonymous android.os.AsyncTask) A static field will leak contexts. Non-static inner classes have an implicit reference to their outer class. If that outer class is for example a Fragment or Activity, then this reference means that the long-running handler/loader/task will hold a reference to the activity which prevents it from getting garbage collected. Similarly, direct