Hi,
Currently I am working on an Android application that is dynamically creating controls. Everytime a user would click a button a new EditText appears below the button and the user can interact with the EditText. However if the screen orientation changes, the EditText's that the user created also disappears.
Code sample of user creating a EditText: (located in a onClick(), p is basic layoutParamas, and layout is a LinearLayout located undearneath the button)
EditText editText = new EditText(this);
layout.addView(buttonView, p);
Wondering what would be the easiest way to save the layout when the screen orientation changes so I do not loose any of the controls, or am I dyanmically creating the controls wrong.
Thanks.
update: By overriding the onSaveInstanceState() I was able to save a object which contained a list of all the controls the user orignally added. Using this list I was able to create the controls in the onCreate().
Still curious if there is an easier way to accomplish this task, as I would have to refactor a lot of code to fully implement this method.