Do I need to clear all dialogues from my activities?

In my activity, I show a dialog under some conditions like this:

public void showADialog(String title, String msg) {
    if (mIsActivityRunning) {
        new AlertDialog.Builder(this)
        .show();
    }
} 

My question is - what do I need to do so that there is no leakage of resources? From logcat, I see that there is a case where he says that a window is leaking from him or something like that.

+3
source share
1 answer

When the dialog box closes, how do you reject it? If you use the method hide(), it will not actually lead to the rejection of the dialog box.

EDIT: You need to get rid of the dialog because the operation has been deleted - see this question for more details.

+1
source

Source: https://habr.com/ru/post/1767282/


All Articles