I am making a Education Questionnaire App.
As far as layouts are concerned, there are 10 layouts:
1 Introduction Page
2 Main Selection
3 Chapter Selection
4 Completion page
5 Question Layout 1
6 Question Layout 2
7 Question Layout 3
8 Question Layout 4
9 Explanation Layout 1
10 Explanation Layout 2
I have already made these 10 XML layouts
. (The whole layout changes, so fragment
not possible)
Now comes the question of connecting them with Java.
Flowchart
After the Chapter Selection Page, the user answers 14 questions(Question Layout 1 to 4)with view data changed. Ideally, I want the back button to be used throughout the chapter so the stack will consist of 14 Activities per Chapter (1 question per screen/activity).
I need to confirm which is the best way to go about this.
Option 1
In total there are 120 chapters, so should I create 14 X 120 activities.(Sounds tiresome) Will it affect app usage speed?
Option 2
Restrict the back button to one per chapter (i.e. make one activity per chapter). Then I'll have to make 120 activities only.
In this case, in 1 activity, the 4 Question layouts will change view data 14 times (approx) with button clicks. How can I achieve this?
Search Results
I have found similar questions here but they talk about either using same layouts for each activity (Eg In Android, can I have different Activities use the same XML file?) or different view data per activity (Eg. Use single xml layout for multiple activities with different datas). A similar question (Using multiple layouts in single activity) was asked but the answers were not implementable.
Question
My question is : Which is the better option? In case Option 2, please give me a sample. I am using Android Studio 3.0