Handle screen orientation changes when there are AsyncTasks running

后端 未结 3 1555
庸人自扰
庸人自扰 2020-12-01 02:15

I\'ve been bugged by this for a while. How do I properly handle screen orientation changes while I have a separate Thread / AsyncTask running? Curr

3条回答
  •  [愿得一人]
    2020-12-01 02:48

    I already popped up similar question here.

    Basically there is an example of how to pause/resume an AsynTask on device rotation. However it still does not fit for all cases (sometimes it is not possible to safely suspend the action, such as a new user creation on a remote server). For those "unsafe" cases you need to code somewhat I'd call a tricky "framework". You will see CommonsWare gives github links to the one.

提交回复
热议问题