How to deal with orientation change with a ProgressDialog showing?

前端 未结 6 1119
余生分开走
余生分开走 2020-12-09 17:38

I am showing a ProgressDialog in the onPreExecute method of an AsyncTask object and canceling the ProgressDialog in the onPostExecute

6条回答
  •  不知归路
    2020-12-09 17:56

    You want to properly handle the activity lifecycle, which means saving and restoring the state of your activity, not attempting to prevent lifecycle changes. Do some reading on AsyncTask vs. the activity lifecycle.

    For example: pause-and-resume-asynctasks-android and what-to-do-with-asynctask-in-onpause.

提交回复
热议问题