Do I have to clean up all dialogs 'show' by my activity
In my activity, I show a dialog under some condition 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 to ensure there is no resource leak? From the logcat, i see there is a case where it said a window is leaking or something like that.
When the dialog box closes, how are you dismissing it? If you are using the hide()
method, this won't actually dismiss the dialog.
EDIT: You need to dispose of the dialog box as the Activity is disposed of - see this question for more details
精彩评论