• <bdo id='WHaNx'></bdo><ul id='WHaNx'></ul>

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

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

      Android - 创建进度对话框

      时间:2023-09-28
      <tfoot id='Tnk4Z'></tfoot>
        <legend id='Tnk4Z'><style id='Tnk4Z'><dir id='Tnk4Z'><q id='Tnk4Z'></q></dir></style></legend>
            <tbody id='Tnk4Z'></tbody>
            • <bdo id='Tnk4Z'></bdo><ul id='Tnk4Z'></ul>
                <i id='Tnk4Z'><tr id='Tnk4Z'><dt id='Tnk4Z'><q id='Tnk4Z'><span id='Tnk4Z'><b id='Tnk4Z'><form id='Tnk4Z'><ins id='Tnk4Z'></ins><ul id='Tnk4Z'></ul><sub id='Tnk4Z'></sub></form><legend id='Tnk4Z'></legend><bdo id='Tnk4Z'><pre id='Tnk4Z'><center id='Tnk4Z'></center></pre></bdo></b><th id='Tnk4Z'></th></span></q></dt></tr></i><div id='Tnk4Z'><tfoot id='Tnk4Z'></tfoot><dl id='Tnk4Z'><fieldset id='Tnk4Z'></fieldset></dl></div>
              • <small id='Tnk4Z'></small><noframes id='Tnk4Z'>

                本文介绍了Android - 创建进度对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                我是安卓开发新手.我想在我的应用程序中开发一个带有 progressbardialog.当我单击搜索按钮时,dialog 应该与 progressbar 一起出现,显示在切换到另一个 activity 之前进度正在进行.请用示例代码向我推荐.

                I am new to android development. I want to develop a dialog with a progressbar in my application. When i click the search button the dialog should appear with the progressbar, showing that the progress is going on before switching to another activity. Please suggest me with sample code.

                推荐答案

                使用 ProgressDialog.不过,您应该在一个新的 thread 上完成这项工作,并在完成后使用 handler 回调 activity.这是我的做法:

                Use a ProgressDialog. You should do the work on a new thread, though, and use a handler to call back to the activity when finished. Here's how I do it:

                private ProgressDialog pd;
                
                private View.OnClickListener searchClick = new View.OnClickListener() {
                
                    @Override
                    public void onClick(View v) {
                        pd = ProgressDialog.show(MyActivity.this, "Searching...", "Searching for matches", true, false);
                        new Thread(new Runnable() {
                                public void run() {
                                    //do work
                                //.....
                
                                finishedHandler.sendEmptyMessage();
                                }
                            }).start();
                    }
                }
                
                private Handler finishedHandler = new Handler() {
                    @Override public void handleMessage(Message msg) {
                        pd.dismiss();
                        //start new activity
                    }
                }
                

                这篇关于Android - 创建进度对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:在对话框列表中设置文本样式 下一篇:如何在android中创建上述自定义对话框?

                相关文章

                最新文章

                  <bdo id='8p2Fe'></bdo><ul id='8p2Fe'></ul>

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

                  <small id='8p2Fe'></small><noframes id='8p2Fe'>