欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android中ProgressDialog的dismiss()与cancel()方法的区别

程序员文章站 2023-03-28 12:46:49
progressdialog, 它有两个方法dialog.cancel() 和 dialog.dimiss() 1. public void cancel ()...

progressdialog, 它有两个方法dialog.cancel() 和 dialog.dimiss()

1. public void cancel ()

since: api level 1
cancel the dialog. this is essentially the same as calling dismiss(), but it will also call your dialoginterface.oncancellistener (if registered).

2.public void dismiss ()

since: api level 1
dismiss this dialog, removing 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().

其中,采用cancel()方法会调用dialoginterface.oncancellistener ()。

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持!