0

I'am trying to create a multiple-step registration activity that handles several fragments. Each fragments is a step in the process and the final fragment should send the registration information collected in all fragments to a server and get a response. My problem is thinking how should I handle the information across fragments so that if the user goes back one step he will not loose the previously typed information. And also how should I handle these Fragment transactions. I was thinking in storing all the data in the activity and retrieve it each time the user goes back one step and then retrieve it in the final fragment to send the information but I don't think this is the best approach. Is there any way to do this cleanly?

Dazt
  • 103
  • 8
  • 1
    Possible duplicate of [How to pass values between Fragments](http://stackoverflow.com/questions/16036572/how-to-pass-values-between-fragments) – NoChinDeluxe Jan 05 '16 at 20:18

1 Answers1

0

Since fragments run on top of activities, I think the way to do this cleanly would be to have your fragments communicate back to the activity.

Basically the approach you are thinking about is correct.

meda
  • 45,103
  • 14
  • 92
  • 122
  • How can I communicate back to the Activity? Should I change variables in the activity and finish the current fragment instance in the stack? – Dazt Jan 06 '16 at 04:59