【发布时间】:2012-12-07 02:35:29
【问题描述】:
我试图在 AlertDialog 的 onClick 事件中显示 ProgressDialog,代码有效,但 ProgressDialog 似乎卡在了 AlertDialog 后面,这不符合要点
public class MainActivity extends Activity
{
@Override
public void onCreate(Bundle savedInstanceState)
{
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Title").setMessage("Message").setPositiveButton("Yes", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ProgressDialog pd = ProgressDialog.show(MainActivity.this, "Title", "Text", true, false);
【问题讨论】:
-
为什么不关闭警报对话框?
-
试过了,似乎不起作用,因为 onClick 事件它似乎将 AlertDialog 放在前面,如果有人有办法以任何方式使这项工作更好,我会很高兴看看吧。
-
有问题,查看我的答案。
标签: android android-alertdialog progressdialog onclicklistener