Roger
Roger

Reputation: 4259

Save dynamically created layout?

I have an activity that lets users add textviews. Click a button, a new textview is created, they can change the text or delete it. They can add up to 10 textviews.

I would like to be able to save these dynamically created layouts, preserving the newly created textviews and their text, so they can be loaded on command. How might I do that?

Upvotes: 2

Views: 379

Answers (1)

Vladimir Ivanov
Vladimir Ivanov

Reputation: 43098

You can iterate through views of your layout using getChildAt(int index) and getChildCount() and save them to some xml format in order to restore them later.

Upvotes: 1

Related Questions