Doubt about canvases of a questionnaire (quiz)

Asked

Viewed 683 times

0

I’m making an APP like this from the image below. My question is how to do, for example as we can see, has 35 questions and is the first being answered, in which case has to have 35 Activity?

What would be the best approach in this case?

In my APP, you’ll have an option to enter the questions, so I don’t know the exact number of questions the questionnaire will have...

Thank you!

inserir a descrição da imagem aqui

  • Your question has many other questions.. But, roughly speaking, you can only have 1 Questions Activity and reload the information on the screen.You can use a counter to know which question to load (if they are always in the same order). About not knowing how many questions will be, you can have a new specific activity to be made this registration.

1 answer

5

Your question can be answered with a simple context analysis:

It makes sense for you to change the user context (change Activity) just to change the question? If you think it makes sense, then the answer is yes, you will need to create a Activity for each question.

But in my opinion, it makes no sense to change the user’s context just for that. You can both use Fragments, or update it Activity, making an animation for the next question for example.

If your application has all questions embedded in the project (offline), you can, for example, create an Object Array and, with each question answered, update the screen with the next question by storing the user’s answer in a separate Array.

If on the other hand your application has the questions online (coming from a webservice/API), to each answered question you ask the next question to the server and stores the user’s answer, also in an Array.

  • 1

    That makes sense, buddy. I’ve asked a question before but I put all the questions in a Listview, but this way is new to me but I’ll try!!

  • @sicachester If he chose to store in an Object Array, this question had an image which could be done.

  • @Rodolfo you can create a template called Pergunta, for example, and have an object Bitmap (or any other type of your image) within the template. Then just create a List<Pergunta>

  • @sicachester the model would be a layout ?.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.