App crashing as it calls the EXERCISE screen with Clock-Timer & Text to Speech





blocks(0)

I have put the block of code corresponding to one exercise type
the code will follow the order of the block names - block 0, block 1, block 2, block 4, block 5 for this particular exercise type.

Scenario when the App Crashes

  1. If i direclty launch the exercise screen for testing it works
  2. If i navigate to exercise screen from main menu it crashes. The main menu has the code just to call the exercise screen using the control block

and in this block ?

image

This block is just to initialize a variable
blocks

I am also intermittently getting an error, on my "Text to Speech 1" saying the arguments cannot be accepted.
As ghostly as it sounds, in one of the previous versions of the code, even though i removed the "Text to Speech 1" i was still getting the same error.

I have later added back the "Text to Speech 1" as seen in above blocks.
Screen Snapshot on arguments for Text to Speech

Could be that TextToSpeech needs a little time to get itself initialised.

Try setting a clock timer of @ 250ms before calling it.

Also untick timer always fires for your clocks in the designer.

That run time error looks like it is attempting a math operation on a big piece of text.

If you are using Label.Text values for math, make sure they are numbers.

Check your Designer.

I have added the lag for 3 seconds it is still throwing the error stating "invalid arguments for the "Step Forward" text to speech

I checked the designer, the three labels that I am using for math, I had their initial values in the designer as numeric numbers and in the code doing only arithmetic add or subtract

Look for a Label in the Designer that has the initial text "Welcome to ...".

I can barely make it out in your fuzzy error message image.

Errors like this are easier to avoid if you rename components in the Designer to indicate their type and purpose, like lblCounter.

If you can't find it,

Export your .aia file and upload it here.
export_and_upload_aia

Hi - The issue is resolved now.
I have followed your guidance and there was a label in the calling screen (the Main Screen) with hard-coded text on "Welcome to Step.."
I then renamed all the labels to meaningful names.
This resolved the arguments error.
However, the screen was still hanging.
Upone checking, i could see (it was in front of my eyes all along) that in the calling screen (Main Screen), I have enabled "Clock1-Timer enabled" to true. It is the same Clock1-Timer being used by the first exercise in the called screen (Exercise screen)

Once, I removed this line of code from calling screen (Attached the screen snapshot for reference), the app is no longer hanging or closing out.
I also renamed the clocks following your earlier suggestion.

Many Thanks for taking your time and providing the guidance.

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