我在dialogfragment中嵌套了viewpager+fragment,我想实现点击fragment中的按钮返回数据到dialogfragment中的textview上,应该怎么做啊
可以使用接口回掉:
在Fragment中定义接口:
private isShowRightBtnInterface inFace;
public interface isShowRightBtnInterface {
void setRightBtn(String isShow);
}
public void setRightBtnCallBack(isShowRightBtnInterface isShow) {
this.inFace = isShow;
}
if (inFace != null) {
inFace.setRightBtn("1111111");
}
dialogfragment中实现该接口:
((dialogFragment) mFragments.get(0)).setRightBtnCallBack(new DeviceCheckOutFragment.isShowRightBtnInterface() {
@Override
public void setRightBtn(String isShow) {
setTitle("水电费水电费");
}
}
});