Android的等待用户输入在AlertDialog继续继续、用户、Android、AlertDialog

2023-09-13 02:17:15 作者:世界的旁观者

我已经看到这个题目在这里讨论,但似乎无法理解如何进行。

I've see this subject been discussed here but can't seem to understand how to proceed.

在我的的onCreate 我有code来检查,如果它是应用程序 firstRun =获取preF的第一次运行。 getBoolean(firstRun,真); 。如果它的第一次应用程序运行时,一个alertdialog显示有一条消息说,多数民众赞成没有安装数据库和用户以preSS的确定按钮下载到数据库中。如果有比 pref.putBoolean没有错误(firstRun,假); ,它不是在未来的运行中所示的alertdialog

In my onCreate I have code that checks if it is the first run of the application firstRun = getPref.getBoolean("firstRun", true);. If its the first time that the app is run, an alertdialog is shown with a message saying thats there is no database installed and the user as to press the OK button to download the database. If there are no errors than pref.putBoolean("firstRun", false); and the alertdialog it's not shown in the next runs.

现在我想介绍一个更新日志,它是应用程序被安装或升级后,才会显示在第一次运行。由于更改日志必须出现在 firstRun 检查之前,我应该等待用户preSS更改日志alertdialog 确定按钮。

Now I want to introduce a ChangeLog that it is only shown on the first run after the app is installed or upgraded. Since the changelog must come before the firstRun check, I should wait for the user press the changelog alertdialog OK button.

我已经创建了code的更新日志(它的工作如预期),之后code,我有 firstRun的code 。问题是,更改日志显示,但比,如果应用程序,其实际上第一次运行时, firstRun alertdialog是重叠的changelog alertdialog。

I've created the code for the changelog (it's working as expected) and after that code, I have the code of the firstRun. The problem is that the changelog is shown but than, if its in fact the first run of the app, the firstRun alertdialog is overlapping the changelog alertdialog.

所以,这里是我的问题。

So, here is my question.

什么是继续使 firstRun code是用户$ P $后才能执行最好等待psses的确定上的更新日志alertdialog按钮?

What's the best wait to proceed so that the firstRun code is only executed after the user presses the OK button on the changelog alertdialog?

推荐答案

我的理解是,更新日志运行每月第一个应用程序的运行。所以,你可以覆盖 onDismiss()更新日志AlertDialog 的。然后,只需把你的$ C $下 firstRun 检查

What I understand is that the changeLog will run every first run of the app. So you can override onDismiss() of your changeLog AlertDialog. Then just put your code for firstRun check

@Override
public void onDismiss(DialogInterface dialog)
{
    // firstRun Check
    // call function to run AlertDialog code for first check if firstRun == true else close dialog
}