To Ghica.
Procedure groupA is a code parsing procedure which inputs part of a scanned qr code, the code uses an integer from text method, in order to convert text into a number. The groupA procedure works perfectly is already cross-checked and always checks as supposed. Therefore I don't think that the error lies in that procedure.
To SteveJG
I have turned the 'Do it' function over into a global variable but still, the app does not work as supposed. In fact what I am experiencing all the time is that only the final state of the for loop works. Namely, there should be a totally different result at iteration 2^8 which is the initial state and a totally different result for iteration 2^0 which is the final state. I can only obtain what's happening in the final state alone. Keep in mind that with static numbers the app works as supposed. Namely, if I do not use a for loop but insert the numbers of that for loop manually, everything works great.
I cannot understand the asynchronously you mention. AI2 is a single threaded abstract layer of the Android language. As I understand everything is processed at a specific time, once their procedure/operation/result is called upon execution. Please, can you elaborate on that?
What do you mean "the loop has not yet completed when your code attempts to process the equation"? I think that is exactly what that for loop should do for example in C what I would do would look like...
int main {
int powers, powersofTwo, groupAloop, groupA;
for (powers=8; powers>=0; powers--) {
powersofTwo = 2^powers ;
groupAloop = groupA - powersofTwo
}
}
Namely, each iteration from 8 to 0 is stored in local variable powers. So in first time loop, variables are set as follows
- powers=8 --> powersofTwo=256 --> groupAloop=groupA - 256
- powers=7 --> powersofTwo=128 --> groupAloop=groupA - 128
- powers=6 --> powersofTwo=64 --> groupAloop=groupA - 64
- powers=5 --> powersofTwo=32 --> groupAloop=groupA - 32
- powers=4 --> powersofTwo=16 --> groupAloop=groupA - 16
- powers=3 --> powersofTwo=8 --> groupAloop=groupA - 8
- powers=2 --> powersofTwo=4 --> groupAloop=groupA - 4
- powers=1 --> powersofTwo=2 --> groupAloop=groupA - 2
- powers=0 --> powersofTwo=1 --> groupAloop=groupA - 1
Sorry for the detail, I am sure you had it from "hello", I just wanted to be as clear as possible of what I want to achieve. Probably I should make a procedure that would be very long in blocks instead of dividing it for better monitoring, I will try it a let you know.
If you have any insights, I am all ears.