I am developing a tour booking app. In my tour booking page I have two types of forms, one for lead traveller and one for other travellers(That could be an adult or a child).
Lead Traveller fields are:
Title
First Name
Last Name
Gender
Date of Birth
Email
Contact number
Nationality
Other Traveller fields are:
Title
First name
Last name
Gender
Date of Birth
For handling this scenario I created the lead traveller form in my main layout and put the other traveller forms in separate layout because I have to show other traveller form multiple times. On first attempt user gets only lead traveller form. There is button to add more travellers, when user clicks on that he'll get the other traveller form. For showing other traveller form I inflated the otherform.xml file. I am using fragments not Activity for this purpose.
My problem is after submitting and moving to next booking step(Moving to next fragment). If I comeback to change some traveller info. My all inflated layouts(other traveller forms) gone. And my last other traveller form fields data transfers into my lead travellers form fields(only first five fields data changed and remaining three fields data is same that I filled previously).
Is there any way to keep save these inflated layouts on comeback.
Any help would be really appreciated. Thanks in advance
I guess you did try setRetainInstance(true) in onCreate?
Nonetheless if that does not cut it I think you will have to persist the state somehow, either database or a file containing the model data. Then in onCreate inspect the database/file and inflate layouts accordingly.