• <legend id='kyWZN'><style id='kyWZN'><dir id='kyWZN'><q id='kyWZN'></q></dir></style></legend>

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

    1. <i id='kyWZN'><tr id='kyWZN'><dt id='kyWZN'><q id='kyWZN'><span id='kyWZN'><b id='kyWZN'><form id='kyWZN'><ins id='kyWZN'></ins><ul id='kyWZN'></ul><sub id='kyWZN'></sub></form><legend id='kyWZN'></legend><bdo id='kyWZN'><pre id='kyWZN'><center id='kyWZN'></center></pre></bdo></b><th id='kyWZN'></th></span></q></dt></tr></i><div id='kyWZN'><tfoot id='kyWZN'></tfoot><dl id='kyWZN'><fieldset id='kyWZN'></fieldset></dl></div>
    2. <tfoot id='kyWZN'></tfoot>

          <bdo id='kyWZN'></bdo><ul id='kyWZN'></ul>

        5秒后Android关闭对话框?

        Android close dialog after 5 seconds?(5秒后Android关闭对话框?)

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

              <legend id='9xGl7'><style id='9xGl7'><dir id='9xGl7'><q id='9xGl7'></q></dir></style></legend>

              <small id='9xGl7'></small><noframes id='9xGl7'>

              <tfoot id='9xGl7'></tfoot>
                <tbody id='9xGl7'></tbody>
                • 本文介绍了5秒后Android关闭对话框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在开发一个无障碍应用.当用户想离开应用程序时,我会显示一个对话框,他必须在其中确认他想离开,如果他在 5 秒后未确认,则对话框应自动关闭(因为用户可能不小心打开了它).这类似于您更改屏幕分辨率时在 Windows 上发生的情况(出现警告,如果您不确认,它会恢复到以前的配置).

                  I'm working on an accesibility app. When the user wants to leave the app I show a dialog where he has to confirm he wants to leave, if he doesn't confirm after 5 seconds the dialog should close automatically (since the user probably opened it accidentally). This is similar to what happens on Windows when you change the screen resolution (an alert appears and if you don't confirm it, it reverts to the previous configuration).

                  这就是我显示对话框的方式:

                  This is how I show the dialog:

                  AlertDialog.Builder dialog = new AlertDialog.Builder(this).setTitle("Leaving launcher").setMessage("Are you sure you want to leave the launcher?");
                              dialog.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
                                  @Override
                                  public void onClick(DialogInterface dialog, int whichButton) {
                                      exitLauncher();
                                  }
                              });
                              dialog.create().show();
                  

                  如何在显示 5 秒后关闭对话框?

                  How can I close the dialog 5 seconds after showing it?

                  推荐答案

                  final AlertDialog.Builder dialog = new AlertDialog.Builder(this).setTitle("Leaving launcher").setMessage("Are you sure you want to leave the launcher?");
                  dialog.setPositiveButton("Confirm", new DialogInterface.OnClickListener() {
                      @Override
                      public void onClick(DialogInterface dialog, int whichButton) {
                          exitLauncher();
                      }
                  });     
                  final AlertDialog alert = dialog.create();
                  alert.show();
                  
                  // Hide after some seconds
                  final Handler handler  = new Handler();
                  final Runnable runnable = new Runnable() {
                      @Override
                      public void run() {
                          if (alert.isShowing()) {
                              alert.dismiss();
                          }
                      }
                  };
                  
                  alert.setOnDismissListener(new DialogInterface.OnDismissListener() {
                      @Override
                      public void onDismiss(DialogInterface dialog) {
                          handler.removeCallbacks(runnable);
                      }
                  });
                  
                  handler.postDelayed(runnable, 10000);
                  

                  这篇关于5秒后Android关闭对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Lucene Porter Stemmer not public(Lucene Porter Stemmer 未公开)
                  How to index pdf, ppt, xl files in lucene (java based or python or php any of these is fine)?(如何在 lucene 中索引 pdf、ppt、xl 文件(基于 java 或 python 或 php 中的任何一个都可以)?)
                  KeywordAnalyzer and LowerCaseFilter/LowerCaseTokenizer(KeywordAnalyzer 和 LowerCaseFilter/LowerCaseTokenizer)
                  How to search between dates (Hibernate Search)?(如何在日期之间搜索(休眠搜索)?)
                  How to get positions from a document term vector in Lucene?(如何从 Lucene 中的文档术语向量中获取位置?)
                  Java Lucene 4.5 how to search by case insensitive(Java Lucene 4.5如何按不区分大小写进行搜索)
                • <i id='88rDG'><tr id='88rDG'><dt id='88rDG'><q id='88rDG'><span id='88rDG'><b id='88rDG'><form id='88rDG'><ins id='88rDG'></ins><ul id='88rDG'></ul><sub id='88rDG'></sub></form><legend id='88rDG'></legend><bdo id='88rDG'><pre id='88rDG'><center id='88rDG'></center></pre></bdo></b><th id='88rDG'></th></span></q></dt></tr></i><div id='88rDG'><tfoot id='88rDG'></tfoot><dl id='88rDG'><fieldset id='88rDG'></fieldset></dl></div>
                    <tbody id='88rDG'></tbody>
                      <bdo id='88rDG'></bdo><ul id='88rDG'></ul>
                      <legend id='88rDG'><style id='88rDG'><dir id='88rDG'><q id='88rDG'></q></dir></style></legend>

                        <tfoot id='88rDG'></tfoot>

                        <small id='88rDG'></small><noframes id='88rDG'>