gpt4 book ai didi

android - AlertDialog.dismiss()?

转载 作者:行者123 更新时间:2023-11-29 01:50:18 27 4
gpt4 key购买 nike

我是 android 新手,正在从 developer.android.com 网站学习。然后我遇到了 AlertDialog.dismiss(),网站上写着

This method Dismiss dialog and remove it from the screen. This method can be invoked safely from any thread. Note that you should not override this method to do cleanup when the dialog is dismissed, instead implement that in onStop().

但是我没看懂这行的意思-

Note that you should not override this method to do cleanup when the dialog is dismissed, instead implement that in onStop()

上面一行的意思是什么?

`.

最佳答案

AlertDialog.dismiss()如果按照开发者网站上的描述打开对话框,则用于关闭对话框

Note that you should not override this method to do cleanup when the dialog is dismissed, instead implement that in onStop() .

上面的语句只是意味着我们曾经垃圾收集在class中不再引用的对象并可用于 garbage collect .他们正在简单地说明像 avail for garbage collection 这样的方法也适用于这里但里面有资格onStop()Activity .

最好将它用作 onStop()因为这是 Activity Life Cycle 的最后一次通话这可以解雇你的alertdialog .如果它出现在屏幕上而不被解雇。

关于android - AlertDialog.dismiss()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18557950/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com