How to set a cancel button in Progress Dialog?

前端 未结 3 616
温柔的废话
温柔的废话 2020-12-13 08:18

I want to set a cancel button in my ProgressDialog. Below is my code:

myDialog = new ProgressDialog(BaseScreen.this);
myDialog.setMessage(\"Load         


        
3条回答
  •  醉梦人生
    2020-12-13 08:46

    Make sure you call myDialog.setButton before calling myDialog.show();
    Also you can use myDialog.setButton("Cancel", (DialogInterface.OnClickListener) null); if you only need to close the dialog on button click.

提交回复
热议问题