How to clear Intent that started Activity?

后端 未结 9 1169
攒了一身酷
攒了一身酷 2021-02-03 21:07

At the beginning Activity is launched by an Intent and something is done with this Intent.

When I change orientation of my Activity, it\'s reloaded again and Intent is

9条回答
  •  被撕碎了的回忆
    2021-02-03 21:48

    If your intent is sent to your activity with an action (with setAction), just do the following when you receive the intent, to avoid multiple handling of this intent when screen rotates :

    Intent i = getIntent();
    i.setAction(null);
    setIntent(i);
    

提交回复
热议问题