Problems when handling orientation changes

后端 未结 3 944
刺人心
刺人心 2020-12-19 11:35

I need to handle orientation changes in my Android application. For this purpose I decided to use OrientationEventListener convenience class. But his callback m

3条回答
  •  悲&欢浪女
    2020-12-19 11:52

    This is a documented bug in the emulator ONLY. A real device will not exhibit this double-lifecycle-events behavior. I had the same issue a while ago and it disappears on a real device.

    I would suggest ignoring the problem if you can by only testing orientation changes in one direction until you get your hands on a physical phone. Otherwise you might be able to "skip" the second set of lifecycle calls by keeping a static boolean around indicating you've already gone through the first set.

    See this issue report for more info.

提交回复
热议问题