Android Back Button and Progress Dialog

前端 未结 9 2065
攒了一身酷
攒了一身酷 2021-01-31 03:24

I have an AsyncTask that shows a progressDialog whilst working (it calls runOnUiThread from within doInBackground to show the progress dialog).

<
9条回答
  •  花落未央
    2021-01-31 03:55

    This can be achieved by the following code fragment:

    progress.setCancelable(true);
    progress.setCanceledOnTouchOutside(false);
    

    progress is the ProgressDialog object...

    This will enable the back button to close the dialog but prevent any touch input to do that...

提交回复
热议问题