Skip to content
Advertisement

Java Android Studio Open Answer Quiz Execution error

I used this Youtube Tutorial: https://www.youtube.com/watch?v=AkUfACbi6BE to create an Open Answer quiz in Android Studio using Java. I followed the tutorial exactly, but when I ran the code on a device, even if I answer questions incorrectly, it says I won the game. I am not sure why it isn’t validating answers correctly. Any tips on how to fix this would be great! The code for the app is below, since the video does not provide source code, thought it would be useful.

Database Class:

JavaScript

Item Class:

JavaScript

MainActivity Class:

JavaScript

XML File Code:

JavaScript

Advertisement

Answer

The reason your code is failing is due to this piece of code.

JavaScript

The way the code is written is such that you cannot move to the next part of the code until you give the correct answer . When you set it to View.VISIBLE it lets you go to the next question without answering it correctly.

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