首页 > 编程学习 > Android:解决ProgressDialog提示框不转动
20115 月19

Android:解决ProgressDialog提示框不转动

ProgressDialog 解决“第一次执行图标转动,第二次执行不转动”代码:

@Override
    protected Dialog onCreateDialog(int id) {
        switch (id) {
        case PROGRESS_DIALOG:
            progressDialog = new ProgressDialog(LoginActivity.this);
            progressDialog.setMessage("正在登陆,请稍等...");
            progressDialog.setCancelable(true);
            // 设置ProgressDialog 是否可以按退回按键取消
            return progressDialog;
        default:
            return null;
        }
    }

    @Override
    protected void onPrepareDialog(int id, Dialog dialog) {
        switch (id) {
        case PROGRESS_DIALOG:
            dialog
                    .setOnDismissListener(new DialogInterface.OnDismissListener() {
                        @Override
                        public void onDismiss(DialogInterface dialog) {
                            removeDialog(PROGRESS_DIALOG);//这个起作用
                            if (progressThread != null) {
                                progressThread = null;
                            }
                        }
                    });
        }
    }

本文地址:https://wizzer.cn/archives/1777 , 转载请保留.

One Response to “Android:解决ProgressDialog提示框不转动”

  1. #1 手机博客 回复 | 引用 Post:2011-05-25 08:46

    没有太多时去写原创的博客文章!

发表评论