简体   繁体   中英

Restore dynamic view state in the fragment

I add my views programmatically.How i can restore states of my views after the fragment is killed ?

I think it can be done with `onViewStateRestored, but i can not configure it's properly.

How i can do it in a right way?

No matter how do you creating views (programmatically or in layout file). Save current fragment state in onSaveInstanceState() and restore it in onCreateView() .

See the onSaveInstanceState() reference for further details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM