Android中dismissDialog(int id)和removeDialog(int id)两个接口有什么区别
天蓬老师
天蓬老师 2017-04-17 12:04:32
0
2
680
天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(2)
左手右手慢动作

Well, your understanding is correct and can be verified through the specific source code

//从Activity管理的容器中移除dialog的引用(可以近乎理解为销毁),并不显示对话框
public final void removeDialog(int id) {
    if (mManagedDialogs != null) {
        final ManagedDialog md = mManagedDialogs.get(id);
        if (md != null) {
            md.mDialog.dismiss();
            mManagedDialogs.remove(id);
        }
    }
}

//仅仅是不显示对话框,便于再次使用。
public final void dismissDialog(int id) {
    if (mManagedDialogs == null) {
        throw missingDialog(id);
    }

    final ManagedDialog md = mManagedDialogs.get(id);
    if (md == null) {
        throw missingDialog(id);
    }
    md.mDialog.dismiss();
}
小葫芦

It has been deprecated in the new SDK. Not recommended. As for other books, try to read new ones

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template