package com.cheng.bigtalkdesignpatterns.mediator; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import com.cheng.designpatternstudy.R; public class BTDPMediatorActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_btdp_mediator); } public void onClick(View v) { ConcreteMediator m = new ConcreteMediator(); ConcreteColleague1 c1 = new ConcreteColleague1(m); ConcreteColleague2 c2 = new ConcreteColleague2(m); m.setColleague1(c1); m.setColleague2(c2); c1.send("吃过饭了吗?"); c2.send("没有呢,你打算请客?"); } }