Search code examples
javaandroidandroid-activitycloneandroid-view

Cloning an android activity dynamically?


I'm creating an application with a rather dynamic UI that allows users to add/change the positions of its views and layouts dynamically. If the user decides that current UI design satisfies him he would be able to save all views(buttons/labels/switches/etc.) of the activity into a list of "saved" activities. Is there a possible way to clone an activity or at least save the positions of all views and layouts? I saw that views have functions .getX() and .getY() but as far as I understood it is only within a layout.


Solution

  • Update

    I found a solution that works. I created a simple Sqlite Database the stored the XY locations/names/text/id of all my views in to a table dynamically and then displayed them in a list of 'saved' configurations. The hard part is creating dynamically again all the views after you get the DB. If there is a request, I can also put some code up.