Android - screen orientation reloads activity

后端 未结 5 405
野性不改
野性不改 2020-12-30 15:13

im going to re-ask this question because there is SO much bad information out there its really depressing. the short story is that i dont want anything to change or happen w

5条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-30 15:25

    what worked for me is declaring one of the class variables as static. it turns out that static class variables are initialized once when the application is being loaded, but when the application is being reloaded, these won't be initialized again.

    these variables could hold a state or an object that you don't want to reinitialize. I can't say that this is not super elegant, but tested and worked for me.

提交回复
热议问题