1. 程式人生 > >mvp銷燬,解決記憶體洩漏

mvp銷燬,解決記憶體洩漏

mvp銷燬,解決記憶體洩漏

//model層銷燬執行緒
public void onDestory() {
if (handler != null) {
handler.removeCallbacksAndMessages(null);
handler = null;
}
}

//presenter層
//銷燬model層
public void onDestory() {
if (loginView != null) {
loginView = null;
}
loginModel.onDestory();
}

//activity
//銷燬presenter層
@Override
public void onDetachedFromWindow() {
super.onDetachedFromWindow();
loginPresenter.onDestory();
}