Good day all, I am working on a practice app that involves fragments, keeping track of data, and SharedPreferences, Here is the scenario, I have a questionnaire-like app, it will ask the user 15 questions but for the sake of this example i'm going to say five(5) and use random questions with yes and no buttons as options.It will look something like this:
|Question 1: Are you a citizen?|
yes/no
|Question 2: Are you human?|
yes/no
|Question 3: Do you sleep a lot?|
yes/no
|Question 4: Do you think you will need help?|
yes/no
|Question 5: Do you often say bye?|
yes/no
|----------------------------|
| |
| |
| |
| fragment displayed here |
| |
| |
|----------------------------|
| |
|yes no |
|----------------------------|
figure 1- Shows how the app looks-both linear layouts split into two
Now, each question is in its own Fragment
-displayed in the "fragments displayed here" section seen in figure 1. The yes and no buttons in the bottom half are NOT supposed to be stagnant but in fact connected to each question. Once the user clicks an option from the buttons, it will display another question. Note: The questions are not a list, the selection of a particular (yes/no) will in turn display the corresponding question.
So for example, Question1:yes will take you to Question3, answering no will take you to Question 4 and so on. Now, each question has the option or chance to give a document or say "You will need document.doc" based on the selection. I need to find a way to keep track of what answers the user picked, and upon calculating those answers along with the chance of displaying a document i will show a results page telling the user: "You will need the following documents: documents.doc, hello.doc etc". The results page shows what all the user chose. e.g
Question1:yes
Question2:no
Question3:yes
Question4:yes
Question5:yes
Result: You will need documents: documents.doc, hello.doc, bye.doc, yes.txt
If anything is not clear, please let me know. Basically now all I want to know is how i can accomplish this task, i would really appreciate it if someone would work with me on getting this done as soon as possible. Thanks SO much in advance to the community.