The first thing to say is im a beginner and now im developing my first “real” android apps(it will be on Google Play).
I already google a lot about this “Quiz” application for android and i cant get good information nor project examples about this one (most of the code/project examples is about a viewFlipper/TextSwitcher changing everytime you touch the screen –thats not what i want). I also tried to search in Stackoverflow and what i got is some downvoted question without a good/helping answer.
So there will be a quiz section in my app, and i will have 3 type of questions :
- A question with a
radiobuttonanswer - A question with a
checkboxlistanswer - A question with an
edittextanswer
There will be about 50 questions in my apps, so i have a plan to create 3 different layouts.
And these are my question’s :
- Do you have any links/examples?please share(I already try to find on my own) 😀
- What is the best way to do this?(Example : like using
viewFlipperwith layouts, or something else) - Is it possible to generate a 3 different types of question(3 layouts) using
viewFlipper?how to do this?
Thank you 😀
You should create one master layout for question, with a
TextViewfor statement, a container (likeFrameLayout) for answer layout , and next , previousButton‘s. In the container you can place two Views, aListViewand anEditTextfor editable answers. Visibility of both as GONE.Now, Once you got master layout visible, you can load each question in same layout. You will need to set text of statement view, if your question has options, you set
ListViewvisibile, load data in it and set it to single/multiple choice. Else, if you question has an editable answer, you setEditTextvisible, (setListViewvisibilty to gone).This will be much more efficient than inflating separate layouts per question, Also
ListViewperfectly handles any number of options , can be single/multiple choice and allows to scroll to any option independent of screen size.Layout Xml: