Error: The operation yail-divide cannot accept the arguments: , [[]], [0]

It keeps giving me this error, can someone help? Here's my code:

Your displayAverage procedure is taking the empty list in global sum and trying to divide it by 0, the length of the global entryActivityLimits.

Make up you mind about global sum.
Is it a list, or is it a number?

AI2 is not the Iverson language APL.
Its math blocks (/) do not work on lists.

1 Like

So what do I change exactly?

I changed the global sum to a number, it still gives an error but it's different.
It states:
The operation + cannot accept the arguments: , [0], [com.google.appinventor.components.runtime.TextBox@fe5943b]

You need to have text there in specific textbox not the textbox itself, you can rearrange smthing this way, using any component,

image

It's still not giving me the average of the numbers entered. Sorry if I'm just being dense.

1 Like

Here is the link to download the code if that helps to find out the problem.
Fitness_App.aia (89.7 KB)

1 Like

Use these :

Make sure that the textboxes have only "numbers" in them. You might want to enable the "Numbers Only" property.

Also, I used my MathTools extension here to get the average.

You can drag the blocks to Blocks Area.

First, this procedure makes a list of the values from the textbox.

Then it sends the list to the extension block to get the Average.

This is a method without an extension.

2 Likes

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