Search code examples
androidandroid-intentorientation-changesandroid-savedstateonsaveinstancestate

Original intent bundle retained upon screen rotation?


Is the original info passed to an activity at creation (e.g. an Intent Bundle from getIntent().getExtras()) retained when the screen orientation is changed? Can I just call getIntent().getExtras() again after rotation to obtain the info again? Or do I need to save that info myself in onSaveInstanceState and retrieve it from the savedInstanceState Bundle?


Solution

  • Is the original info passed to an activity at creation (e.g. an Intent Bundle from getIntent().getExtras()) retained when the screen orientation is changed?

    Yes it is retained. It's also retained for other configuration changes (like keyboard shown, screen size change etc..)

    Can I just call getIntent().getExtras() again after rotation to obtain the info again?

    Yes you can.

    Or do I need to save that info myself in onSaveInstanceState and retrieve it from the savedInstanceState Bundle?

    No need to save it manually.