<small id='vvbRD'></small><noframes id='vvbRD'>

  • <legend id='vvbRD'><style id='vvbRD'><dir id='vvbRD'><q id='vvbRD'></q></dir></style></legend>
    <i id='vvbRD'><tr id='vvbRD'><dt id='vvbRD'><q id='vvbRD'><span id='vvbRD'><b id='vvbRD'><form id='vvbRD'><ins id='vvbRD'></ins><ul id='vvbRD'></ul><sub id='vvbRD'></sub></form><legend id='vvbRD'></legend><bdo id='vvbRD'><pre id='vvbRD'><center id='vvbRD'></center></pre></bdo></b><th id='vvbRD'></th></span></q></dt></tr></i><div id='vvbRD'><tfoot id='vvbRD'></tfoot><dl id='vvbRD'><fieldset id='vvbRD'></fieldset></dl></div>

  • <tfoot id='vvbRD'></tfoot>
      <bdo id='vvbRD'></bdo><ul id='vvbRD'></ul>

        错误的窗口令牌,您无法在创建 Activity 之前或隐

        时间:2023-08-28
        <tfoot id='0MuSR'></tfoot>
            <tbody id='0MuSR'></tbody>

          • <bdo id='0MuSR'></bdo><ul id='0MuSR'></ul>

            <legend id='0MuSR'><style id='0MuSR'><dir id='0MuSR'><q id='0MuSR'></q></dir></style></legend>

                • <i id='0MuSR'><tr id='0MuSR'><dt id='0MuSR'><q id='0MuSR'><span id='0MuSR'><b id='0MuSR'><form id='0MuSR'><ins id='0MuSR'></ins><ul id='0MuSR'></ul><sub id='0MuSR'></sub></form><legend id='0MuSR'></legend><bdo id='0MuSR'><pre id='0MuSR'><center id='0MuSR'></center></pre></bdo></b><th id='0MuSR'></th></span></q></dt></tr></i><div id='0MuSR'><tfoot id='0MuSR'></tfoot><dl id='0MuSR'><fieldset id='0MuSR'></fieldset></dl></div>

                  <small id='0MuSR'></small><noframes id='0MuSR'>

                • 本文介绍了错误的窗口令牌,您无法在创建 Activity 之前或隐藏之后显示对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我在我的应用程序中使用 AppIntro 库.

                  I am using an AppIntro library in my app.

                  它有 3 张幻灯片.当显示第三张幻灯片时,我想问用户一些事情.为了实现这一点,我正在使用 afollestad 的材质对话框.

                  It has 3 slides. I want to ask the user something when the third slide is shown. To achieve that I am using material dialogs by afollestad.

                  我在 AppIntro Activity 中的代码如下所示:

                  My code in the AppIntro Activity looks like that:

                  @Override
                      public void onNextPressed() {
                          if(this.pager.getCurrentItem() == 2) {
                              MaterialDialog dialog = new MaterialDialog.Builder(getApplicationContext())
                                      .title("QR Code scannen")
                                      .content("Möchtest du den QR Code scannen oder selbst eingeben?")
                                      .positiveText("eingeben")
                                      .negativeText("scannen")
                                      .onPositive(new MaterialDialog.SingleButtonCallback() {
                                          @Override
                                          public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                                              Intent intent = new Intent(getApplicationContext(), RegistrationActivity.class);
                                              startActivity(intent);
                                          }
                                      })
                                      .onNegative(new MaterialDialog.SingleButtonCallback() {
                                          @Override
                                          public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
                                              // TODO
                                          }
                                      })
                                      .show();
                          }
                      } 
                  

                  运行应用程序当我滑到第三张幻灯片时出现以下问题:

                  Running the App I get the following issue when I slide to the third slide:

                  com.afollestad.materialdialogs.MaterialDialog$DialogException: 
                  Bad window token, you cannot show a dialog before an Activity is created or after it's hidden.
                  at com.afollestad.materialdialogs.MaterialDialog.show(MaterialDialog.java:1328)
                  at com.afollestad.materialdialogs.MaterialDialog$Builder.show(MaterialDialog.java:1317)
                  at com.ads.adstimer.fragment.Registration.RegistrationActivity.onNextPressed(RegistrationActivity.java:64)
                  at com.github.paolorotolo.appintro.AppIntro$2.onClick(AppIntro.java:118)
                  at android.view.View.performClick(View.java:5204)
                  at android.view.View$PerformClick.run(View.java:21153)
                  at android.os.Handler.handleCallback(Handler.java:739)
                  at android.os.Handler.dispatchMessage(Handler.java:95)
                  at android.os.Looper.loop(Looper.java:148)
                  at android.app.ActivityThread.main(ActivityThread.java:5417)
                  at java.lang.reflect.Method.invoke(Native Method)
                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
                  

                  我真的不明白这个问题.因为 AppIntro Activity 已经加载,我希望它在显示特定片段时显示一个对话框.

                  I do not really understand the problem. Because the AppIntro Activity is already loaded and I expect it to show a dialog when a specific fragment is shown.

                  如何实现在显示特定幻灯片时显示对话框?

                  How can I achieve to show a dialog when a specific slide is shown?

                  推荐答案

                  MaterialDialog dialog = new MaterialDialog.Builder(getApplicationContext())
                  

                  我想你需要在这里传递 Activity 实例,而不是应用程序上下文.

                  I suppose you need to pass the Activity instance here, not the application context.

                  这篇关于错误的窗口令牌,您无法在创建 Activity 之前或隐藏之后显示对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:Android - 如何在 onPause 中关闭所有对话框 下一篇:android中的警报对话框不应关闭

                  相关文章

                  最新文章

                • <tfoot id='KQqAL'></tfoot>
                    <i id='KQqAL'><tr id='KQqAL'><dt id='KQqAL'><q id='KQqAL'><span id='KQqAL'><b id='KQqAL'><form id='KQqAL'><ins id='KQqAL'></ins><ul id='KQqAL'></ul><sub id='KQqAL'></sub></form><legend id='KQqAL'></legend><bdo id='KQqAL'><pre id='KQqAL'><center id='KQqAL'></center></pre></bdo></b><th id='KQqAL'></th></span></q></dt></tr></i><div id='KQqAL'><tfoot id='KQqAL'></tfoot><dl id='KQqAL'><fieldset id='KQqAL'></fieldset></dl></div>
                    <legend id='KQqAL'><style id='KQqAL'><dir id='KQqAL'><q id='KQqAL'></q></dir></style></legend>
                    • <bdo id='KQqAL'></bdo><ul id='KQqAL'></ul>

                    <small id='KQqAL'></small><noframes id='KQqAL'>