My app for AP Computer Science is giving me an error when testing it out-

Screenshot 2024-01-26 9.12.50 AM


In my app I have three buttons with pictures on them. I also have two check boxes named types and sounds. When the sounds box is checked and you click on one of the animals it should make the sound of the animal but it gives me the error in the photo above. And when the types check box is checked and you click on one of the animals, the app should say the name of the animal, but that also gives me the same error. There is also a text box at the top of the images that appears when there are two check boxes checked saying "There are two boxes selected. Select only 1". This works. When I have no boxes checked and click a box it doesn't say anything. It is supposed to say "Select 1 box. Then click an animal". I also have 3 players in my app and lists that list the mp3 file and the type of animals so I can call it. I also have a procedure that is called when the button is clicked. I still, however, don't know what I am doing wrong.

You are calling to a procedure with the first, second or third element of each list, to do what?
In the procedure you have 's' (element of the sounds list) and 't' (element of the animals lists) and you are setting the volume of 's' and 't' ?? the volume must be used with the 'player' component....
In the procedure you are setting to 's' and 't' the lists...What is that supposed to do?

And, where are you indicating to the player component which sound to play? Do you have 3 different components?

The error message you get indicates you are using an ios device. Does the app run correctly if you run on the emulator or an Android device? What you experience could be a ios bug or a timing issue related to how you coded.

  1. you are using complex code to do some simple things. If you just create a Project to play a sound as a test, does the simple app work to play the sound?

  2. your Block image is unreadable. To get a clean image go to Blocks screen;
    right mouse click on the white space in the screen and
    imageofBlocks

to get a png of all your Blocks you can post and everyone can read.

Is this better?

May be this can get you an idea:

Anyway, are you using an ios device?

yes, the image is very clear now. :wink: The coding seems to be your problem.

How about testing a simple app to play only the dog sound and help us to help you find out where the issue may be.

@mia30 Please answer the question / statement

and post the aia.

Another thing, if you want, when the "Type" checkbox is checked, that the word in the list be read, then you will need the TextToSpeech component (instead of the Player) for that part.

I am testing my code on my phone but I'm working on my school chromebook to change and work with my code.

Thank you for your help!

This is my new code.

The only thing is that I need to include a "while" statement and a parameter into this code and don't know where to start. It can be the easiest thing ever and does not even need to be related to animals..

A while statemen to do what?

Parameters are used in procedures to allow them to be reused for different data.
Look for common code patterns repeated in your app, that can be replaced with procedure calls to a common procedure that you supply with the special sound files, pieces of text it needs to work.

While statements are good to use for searching through a list for something.
You will need a list to traverse, possibly searching for the animal name that matched the .Text of the button that was just pressed, to let you know the name of the sound file to play?