简体   繁体   English

android对话框问题

[英]android dialog box issue

I have an issue in android development. 我在android开发中遇到问题。 I want to display Dialog Box when the application is launched before loading and launching the activity. 我要在加载和启动活动之前启动应用程序时显示对话框。

or you can say I want to show the dialog on launcher after the launch of my application. 或者您可以说我想在应用程序启动后在启动器上显示对话框。

为什么不在您的MAIN活动的onCreate中显示对话框?

You should consider having a InitActivity that does what @Teja Kantemneni does : launching a dialog and launching your own "real first activity" when user clicks on the right button. 你应该考虑有InitActivity是做什么@Teja Kantemneni作用:启动一个对话框,并启动自己的“真正的第一项活动”,当用户点击右键。

Alternative : I would also try to do it from the application class itself, but I am not sure of the result. 替代方法:我也将尝试从应用程序类本身执行此操作,但是我不确定结果如何。

Create an application class, reference it in the manifest file, override onCreate and show your dialog. 创建一个应用程序类,在清单文件中引用它,覆盖onCreate并显示您的对话框。 But honestly, I think it will already be too late and your main activity already launched at this point. 但老实说,我认为这已经太迟了,此时您的主要活动已经开始。

Regards, Stéphane 问候,斯特凡

You can show your dialog in your onCreate event in your startup activity. 您可以在启动活动的onCreate事件中显示对话框。

You can then run your main code process once the user has confirmed the dialog (ie. capture the event and process your main code) 用户确认对话框后即可运行主代码过程(即捕获事件并处理主代码)

All this can be done in your onCreateDialog 所有这些都可以在您的onCreateDialog完成

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM