Persistence of ViewPager data
I use ViewPager
to show multiple views of the form, such as name and email, on the first submission and the rest on others.
Now the problem is this:
- Enter the data on page 1, go to page 2, then to page 3.
- go back to page 1, data is not there.
I have a save button on the last page, so I also need a way to get data from other pages there.
If I can get a way I can save the data on page 1 when it is changed to page 2 like a method onDestroy
for the activity.
Wouldn't it suit ViewPager
my purpose here?
I think that ViewPager
suits the purpose. All you have to do is save the data you entered in the first and second snippets to the parents Activity
and retrieve it when you click Save
on your last snippet.
EDIT: Check THIS and THIS related SO questions
I have implemented something like this in my GitHub project: View Pager Form