We all know that an Activity starts a Dialog. After a Dialog disappears, the Activity does not perform any life cycle. [bug Mc-10868] – 1Dialog has its own cancelled listener (doesn’t work)
ad.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(final DialogInterface mDialogInterface) { }});Copy the code
2 writes its own callback that notifies Activity 1 when it disappears
if(mNotifyCall ! = null){ mNotifyCall.notifyData(); }Copy the code
Write callback method in 2Dialog
private NotifyCall mNotifyCall;
public interface NotifyCall {
public void notifyData();
};
public void setNotifyCall(NotifyCall notifyCall){
mNotifyCall = notifyCall;
};
Copy the code
3Activity uses callbacks
Activity implements MyAlertDialog.NotifyCall
ad = new MyAlertDialog(CashHomeActivity.this);
ad.setNotifyCall(this);
@Override
public void notifyData() {
notiyOrder();
}
Copy the code