我不想在单击按钮后隐藏android中的进度对话框,我只想在保持Dialog
出现的同时执行一些操作,我有以下用于创建对话框的代码:
public Dialog onCreateDialog(int id){
switch(id){
case 0 :
// Alert Dialog
return null;
case 1:
progressDialog = new ProgressDialog(this);
progressDialog.setIcon(R.drawable.ic_launcher);
progressDialog.setTitle("Play audio file");
progressDialog.setCancelable(false);
progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
/* progressDialog.setButton(DialogInterface.BUTTON_POSITIVE,"Play",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getBaseContext(),"Hide clicked!",Toast.LENGTH_SHORT).show();
}
});*/
progressDialog.setButton(DialogInterface.BUTTON_NEGATIVE, "Close", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getBaseContext(),"Cancel clicked!",Toast.LENGTH_SHORT).show();
}
});
progressDialog.setButton("Play", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(getBaseContext(),"Cancel clicked!",Toast.LENGTH_SHORT).show();
}
});
return progressDialog;
}
return null;
}