Android对话框关闭时,您可以触发事件吗? [英] Can you fire an event when Android Dialog is dismissed?
本文介绍了Android对话框关闭时,您可以触发事件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
说我在我的Android应用程序中创建了一个对话框:
Say I have a created a dialog in my Android app like so:
private static ProgressDialog dialog;
dialog = ProgressDialog.show(MainActivity.this, "", "Downloading Files. Please wait...", true);
现在,是否可以在调用以下事件时触发事件?
Now, is it possible to fire an event when the following is called?
dialog.dismiss();
我想这么做,而不是在对话框后调用我的方法.dismiss();
是因为Dialog dismiss是在静态类中调用的,接下来我要做的是加载一个新的Activity(在静态类中不能使用Intents)。
The reason I want to do this and not just call my method after dialog.dismiss();
is because the Dialog dismiss is called within a static class and the next thing I want to do is load a new Activity (which cannot be done using Intents within a static class).
推荐答案
使用 OnDismissListener 。
有一个 c>> >
中的<@ c> >
这篇关于Android对话框关闭时,您可以触发事件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文