Can you fire an event when Android Dialog is dismissed?(当 Android Dialog 被解除时,你能触发一个事件吗?)
问题描述
假设我在我的 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();
我想这样做而不只是在 dialog.dismiss();
之后调用我的方法的原因是因为在静态类中调用了 Dialog 解除,而我接下来要做的是加载一个新的 Activity(这不能在静态类中使用 Intent 来完成).
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一个>.
有一个 setOnDismissListener(...)
类中的方法 Dialog
这篇关于当 Android Dialog 被解除时,你能触发一个事件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:当 Android Dialog 被解除时,你能触发一个事件吗?


基础教程推荐
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01