Skip to content
Advertisement

Modifying the scoring of a quiz app (android studio)

Context about the app:

This is a sample 5 question test app that I made while I also learned firebase database just yesterday. The app is working perfectly and it does it needs to do, BUT what I wanna do next is that there are no right answers and each button corresponds to a score

ex: Question: What are you feeling out of 1-5

A.)1 – I am feeling bad B.)2 – I am feeling sad C.)3 – neutral D.)4 – I am feeling happy E.)5 – I am feeling good

As you can see here if the user answers E for example then he gets 5 pts (the points is not shown) and the user will get 1 point if he answers A and so on…

code:

JavaScript

I am doing this since yesterday and I also just learned doing firebase yesterday. I just got stumped for the past hour on what the logic is.

Advertisement

Answer

You need to remove the condition choice4.getText().equals(ans) inside all the choice click listeners. You should also put the code in a common method.

JavaScript

call it from the click listeners rather than duplicating them.

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement