Loading... ```java MyDialog.java //定义一个接口 public interface chuang{ public void chuang(String string); } chuang chuang; public MyDialog(@NonNull Context context,chuang chuang) { super(context); this.chuang=chuang; } public void test(){ chuang.chuang("asd"); } ``` ```java MainActivity.java ... new MyDialog(this, new MyDialog.chuang() { @Override public void chuang(String string) { Log.i("chuang",string); } }).show(); ... ``` Last modification:October 24, 2019 © Allow specification reprint Support Appreciate the author AliPayWeChat Like 1 如果觉得我的文章对你有用,请随意赞赏