onCreateDialog方法可以配置this.showDialog(id)方法使用

 
 

    protected Dialog onCreateDialog(int id)
    {
        switch(id)
        {
            case 1:
            {
                ProgressDialog checkUpdateIng = new ProgressDialog(CallPlayer.this);
                checkUpdateIng.setTitle("正在下载");
                checkUpdateIng.setMessage("请稍候...");
                checkUpdateIng.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                return checkUpdateIng;
            }
            case 2:
            {
                Dialog dialog = new AlertDialog.Builder(CallPlayer.this).setTitle("系统更新").setMessage("发现新版本,请更新!") // 设置内容
                .setPositiveButton("确定", // 设置确定按钮
                        new DialogInterface.OnClickListener()
                        {
                            public void onClick(DialogInterface dialog,int which)
                            {
                                downloadBar = new ProgressDialog(CallPlayer.this);
                                downloadBar.setTitle("正在下载");
                                downloadBar.setMessage("请稍候...");
                                downloadBar.setProgressStyle(ProgressDialog.STYLE_SPINNER);
                                downloadUpdateFile();
                            }

                        }).setNegativeButton("取消",new DialogInterface.OnClickListener()
                        {
                            public void onClick(DialogInterface dialog, int whichButton)
                            {
                                // 点击"取消"按钮之后退出程序
                                init();
                                callPlayer();
                            }
                        }).create();// 创建
                return dialog;
            }
            default:
            {
                return null;
            }
        }
    }

posted on 2012-01-03 20:12  ThunderFox  阅读(484)  评论(0编辑  收藏  举报