Reputation: 383
In my program i create buttons programmatically on OnTouch event but when i reopen the app or activity get restarted these button do not appear Can any one suggest me how can i create buttons programmatically those will stick to the layout even after the activity gets restart or app gets restart
Upvotes: 0
Views: 347
Reputation: 2318
As suggested in Comments saving state in shared preferences is good option . So you can go with this links to know more about this topic, I think it will be more clear when you will look into all this .
Save instance of dynamically generated views when we switch back and forth between activities
How do you save a (user-created) dynamic Layout in Android?
android save programmatically created views
Android - How to save a programmatically created view and restore it on app restart
Upvotes: 0