情况是这样的:
 首先,使用ProgressDialog.STYLE_SPINNER 圆形进度显示,均不会出错。
 使用STYLE_HORIZONTAL 则使用show函数创建的对象会出错。源码  
package com.progressDialog;import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;public class ProgressDialogTest extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        Button button1 = (Button) findViewById(R.id.button1);        button1.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
final ProgressDialog progressDialog = ProgressDialog.show(ProgressDialogTest.this, "ProgressDialog_Run",
"30秒后消失",true);
//final ProgressDialog progressDialog = new ProgressDialog(ProgressDialogTest.this);

progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);  

progressDialog.setIcon(R.drawable.icon);  

progressDialog.setMax(100);  
progressDialog.setProgress(0);  
progressDialog.setSecondaryProgress(50);  
progressDialog.setIndeterminate(false);  
progressDialog.show();
progressDialog.setOnKeyListener(new DialogInterface.OnKeyListener() {

@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
AlertDialog.Builder dialogBuilder = new Builder(ProgressDialogTest.this);
dialogBuilder.setTitle("警告").setMessage("你确定要退出吗?").setPositiveButton("确定", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
progressDialog.dismiss();

}
}).setNegativeButton("取消", new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {

}
}).show();
return true;
}
});

new Thread(){ @Override
public void run() {
int proNum = 0;

try {
while(proNum <= 100){
sleep(100);
proNum++;
progressDialog.setProgress(proNum);
}
} catch (InterruptedException e) {
e.printStackTrace();
}finally{
progressDialog.dismiss();}
super.run();
}
}.start();
}
});
        
    }
    
}
final ProgressDialog progressDialog = ProgressDialog.show(ProgressDialogTest.this, "ProgressDialog_Run",
"30秒后消失",true); 这句只能在圆形进度条中使用,在条形中使用则报错? 何解?
//final ProgressDialog progressDialog = new ProgressDialog(ProgressDialogTest.this); 条形进度条正常!
在Android 1.5中测试的不晓得其他其他版本如何。