I have a problem with summing all values which are programmatically entered by the user in a listview.
The user enters the value in an EditText box, and when a button is pressed, the value is added to the list. This is repeated each time the button is pressed.
How can I get the sum of values entered to the list so far iteratively? Can you help me?
Thank you very much. I was stuck in summing from the array actually, as:
B4X:
Sub btn_add_Click
Dim x_array(x_list.Size) As Float
Dim y_array(y_list.Size) As Float
For i=0 To x_list.Size-1
x_array(i)=x_list.GetItem(i)
Next
For j=0 To y_list.Size-1
y_array(j)=y_list.GetItem(j)
Next
I cannot get the sum of values in x_array, and y_array. I will try your help.
@DonManfred or else, I do not expect you do the coding for me, I can do it for me. Anyway, thanks again.
I suggest with starting the coding by yourself instead of asking questions. At least you should have posted ALL relevant code which you tried but which does not works.
Sub btn_add_Click
Dim sum_x As Float = 0
Dim sum_y As Float = 0
For i=0 To x_list.Size-1
sum_x=sum_x+x_list.GetItem(i)
Next
For j=0 To y_list.Size-1
sum_y=sum_y+y_list.GetItem(j)
Next
However it is a simple sum, I hope for you that you do not develop software as a profession