接口类IPresenter
public interface IPresenter extends Serializable {
void tip(Context context, String msg);
}
实现类MyPresenter
public class MyPresenter implements IPresenter {
@Override
public void tip(Context context, String msg) {
Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
}
}
A页面序列化MyPresenter通过intent.putExtra传递到B页面
Intent intent = new Intent(this, BActivity.class);
intent.putExtra(INTENT_KEY_PRESENTER, new MyPresenter());B页面通过getSerializableExtra拿到IPresenter引用,调用tip
IPresenter presenter = (IPresenter) getIntent().getSerializableExtra(INTENT_KEY_PRESENTER);
presenter.tip(BActivity.this,"message");请问这个流程会导致context内存泄漏吗?(leakCanary检测没有泄漏)