I just started android and went through most basics such as xml and some methods. My goal is to create a program that take N amount of inputs to do some statistics. User will be prompt to enter how many inputs he want, after that, the program will create corresponding number of EditText objects. Then the user will be able to put values into the EditText objects. The program will display statistic stuff (average, sd, etc.) when the user submit the data.
The problem is I need to receive the input for N from user, uses onClick method, dynamically create N amount of EditText objects, and stored number N into some variable for later statistic calculation. However, the onClick method does not inherit the variables from Main method (it is another function). Therefore, if I want to get the input for N from onClick method, I'll have to somehow make the function return that integer...
Another problem is to dynamically create the EditText would mean that I cannot specify the id for each EditText objects (maybe I'm wrong). Then I won't be able to call those EditText's input field into the onClick for calculation.
Even if I can, I still won't be able to use iteration to iterate the id of each EditText objects one by one to do statistic, because id, when we specified it, is a named constant. We did not do any number specifying it, nor we have any control over which integer is which id, right? Maybe I'm wrong; I'm still at newbie level.