gistfile1.txt 1.public interface MyInterface{ void sayYourName();}2.public class Myclass{ pubcli Myclass(){ } //用接口类型的对象作为输入参数 public void lvBudong (MyInterface myInterface){ myInterface.sayYourName(); }3.在Acti
1.public interface MyInterface{ void sayYourName(); } 2.public class Myclass{ pubcli Myclass(){ } //用接口类型的对象作为输入参数 public void lvBudong (MyInterface myInterface){ myInterface.sayYourName(); } 3.在Activity中调用这个类,创建对象并调用其方法,期间实现接口中的抽象方法的具体实现逻辑 public MainActivity extend Activity{ ... Myclass myClass = new Myclass(new MyInterface()){ public void sayYourName(){ } } }); } }