How to handle screen orientation change when progress dialog and background thread active?

前端 未结 28 1890
轮回少年
轮回少年 2020-11-22 07:03

My program does some network activity in a background thread. Before starting, it pops up a progress dialog. The dialog is dismissed on the handler. This all works fine, exc

28条回答
  •  天命终不由人
    2020-11-22 07:47

    Move the long task to a seperate class. Implement it as a subject-observer pattern. Whenever the activity is created register and while closing unregister with the task class. Task class can use AsyncTask.

提交回复
热议问题