开发者

ProgressDialog disappers after screen lock

开发者 https://www.devze.com 2023-03-17 08:39 出处:网络
I have a ProgressDialog that is running and accepting the percent complete from a thread handl开发者_如何学运维e.When the screen is locked, then unlocked, the app returns back to the home screen of th

I have a ProgressDialog that is running and accepting the percent complete from a thread handl开发者_如何学运维e. When the screen is locked, then unlocked, the app returns back to the home screen of the app and does not continue to display the ProgressDialog.

How can I return to the same page with the ProgressDialog on it? I assume I need to somehow save the handle resource and recreate it on onResume but am unsure how to do this.

Thanks.


It seems you're on the right track. Assuming you have class variables showProgressDialog and myProgress:

@Override
protected void onResume() {
    super.onResume();
    if(showProgressDialog)
      {
        myProgressDialog.show();
        myProgressDialog.setProgress(myProgress);
      }

}
0

精彩评论

暂无评论...
验证码 换一张
取 消