在Presenter层中写一个方法
//在presenter层写销毁方法,记得在Activity中销毁处调用
public void destory() {
if (baseModel != null) {
baseModel = null;
}
if (baseView != null) {
baseView = null;
}
System.gc();
}
记得在Acitivity页面中调用这个方法
mainPresenterIml = new MainPresenterIml(new MainModerIml(),this);
mainPresenterIml.doShopCar(0,"http://172.17.8.100/ks/product/getCarts?uid=51");
在onCreate方法外面实现Destory方法
//调用MainPresenterImp中的destroy方法
@Override
protected void onDestroy() {
super.onDestroy();
mainPresenterIml.destroy();
}