Multiple choice with image and sound question material

Good evening from GMT +8 guys.

I have a multiple choice application whose question material is stored in Google Spreadshet.

This quiz runs randomly.

I made the image component is subject of the question. So in the application the question is like: What picture is it?

The “red dot” is, I want to add sound button as the question material too in the app. So the question material in the application has images and sounds. I save sound and image files in G.Spreadsheet in URLs form.

The question is how to make sure that when the question is an image, the image component is displayed and the sound button are hidden. And when the question is a sound, then the sound button is displayed and the image component is hidden.

here is screenshot:

image

image

I’m sorry if the language is not quite right. Any answer would be greatly appreciated.

I don’t see any if/else blocks in your code to do what you are asking but it would look something like this:

If question is about an image
   show image
   hide sound button
else
   hide image
   show sound button

How do you determine if you’re going to ask the user a question about an image or a sound? Is it just a random row number and the skripsi column has a url for an image OR a sound? If so, then you need to do one of the following:

  1. Add a column with a key indicator. Something like “image” or “sound” for each row. That way, you can check the value of that column for the current question and use my if/else algorithm above.

  2. Determine if the url is for an image or a sound (perhaps, does it contain “.png” for example). Then use my if/else algorithm above.

I think you’ll find that #1 is easier and more consistent.

1 Like

Yes! I can do it. Thank you very much.

I see that you are the one who always answers my questions and gives me a lot of hints.

In my language, you are called Al-Huda, or the expert of hint. Thanks

Hopefully in this Ramadan everyone gets a Huda, whoever it is

1 Like

That’s very kind of you, thank you. I’m glad I could help.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.