I've a survey with an undefined number of questions: each time I give an answer, the server respond me back with the new one. Questions are "dynamic", in the sense that the next question depends on the current answer. I've a finite number of question type (e.g. "input a number", "choose a radio", etc) that represents a new screen. How can I handle this requirement, using the Navigation Component
? I cannot declare in advance an action with a destination
, because I don't know the type at compile time. At the moment I've tried to handle it using a single fragment/view model (I'm using MVVM) that dinamically builds itself based on the question, but it's becoming quite a mess. Could you please point me in the right direction? What if I declare as destination the same fragment? Many thanks.
Note: I've excluded the idea of declaring ALL the combination of question/destination, I think that's not a solution.
Asked
Active
Viewed 275 times
3

Jumpa
- 4,319
- 11
- 52
- 100