[英]When the android resources are freed?
我在片段HomeFragment.java中聲明了一個私有變量,
private List<WeatherCard> mWeatherCards = new ArrayList<>();
public class WeatherCard { private String city; private TextView mWeatherIcon; private TextView mCityText; private TextView mTemperatureText; private TextView mRefreshTimeText; private TextView mDescription; private TextView mWindIcon; private CardView mCardView; }
當我按下android導航欄上的后退按鈕時,應用程序關閉並且活動調用了onDestory()方法,但是我發現變量mWeatherCards沒有被回收,並且僅當我使用taskmanager關閉該應用程序時才被清理。 關閉任務管理器和后退按鈕以及釋放Android資源之間的關閉應用程序有什么區別?
當您按下返回按鈕時,應用程序不會退出,它已移至后台並且資源仍處於保留狀態。 如果要退出后退按鈕,可以單擊以下鏈接Android:按下后退按鈕退出應用程序
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.