user8103839
user8103839

Reputation:

Android Studio | Save Layouts permanently

I have a question about saving data locally. When I press a button on my UI, the program generates a FrameLayout with some checkboxes and TextViews. I want to save these Layout Constructions permanently, but all my solutions failed. When I search for that in the web, I only find solutions for saving simple Strings or numbers. I would appreciate for some solutions

Thanks

Upvotes: 2

Views: 251

Answers (2)

I agree with F43nd1r, if you want to after a relaunch of your app goes to an specific layout, what you need to do it's save the state of your app on the local database (using SQLite, Realm, etc) , and when relaunch, load this configs from the local database and inflate the xml layouts based on this configs.

Upvotes: 1

F43nd1r
F43nd1r

Reputation: 7749

Views are not meant to be persisted. They have to be recreated on every application launch.

You can define layouts in xml, and inflate them every time. That is probably closest to what you want to achieve.

Upvotes: 2

Related Questions