I have 25 edittexts
and other views on my activity. I have created different main.xml
files in layout
and layout-land
, so the respective UI will be displayed according to the switched mode(either portrait or landscape).
But After filling values in the edittexts
, if I change from the portrait to landscape, the previous values are lost. So, my doubt is how to get the values from the edittexts
and restore the values at their respective edittexts
even after changing to other mode.
Of course I know when we switch modes, the activity is recreated which results the data loss. I have revised even Handling Runtime changes
in the developer guide, but as a newbie I am unable to understand clearly like onRetainNonConfigurationInstance()
method to save data as it returns object, but in my app I need the numbers that are entered in the edittexts
to be on their respective edittexts
even after switching.
Have referred lot of questions like link etc., even on stackoverflow, but I am unable to find solution for my problem. Please suggest the solution for this.
Even I have another problem. I have a dialog
which pops up when this activity
is first started and I don't want this too to popup
while switching modes. Please suggest the solution for these two. If anyone needs code snippet for more clarification, please let me know. I will edit my question with the code.