is a view's “tag” restored when the activity whose layout contains the view is recreated?

前端 未结 1 833
春和景丽
春和景丽 2021-02-20 12:55

The docs concerning Activity recreation state:

By default, the system uses the Bundle instance state to save information about each View ob

相关标签:
1条回答
  • 2021-02-20 13:25

    if I set a tag on a View (that has a unique id) in my activity's layout and then the activity is destroyed by the system and subsequently re-created, will that view, when recreated, automatically be tagged with the Object I originally set?

    No, based on my reading of the source code.

    The system expects to recreate the activity at some later date, so I could see it keeping around a reference to the original tag.

    That is not always possible, as the saved instance state Bundle needs to be transportable across process boundaries.

    0 讨论(0)
提交回复
热议问题