I have two asyctask that are called at the same time, but I need both two asynctask results to process the next step.
I have one solution: Given two member variable to check the return state of two async task:
boolean b1 = false;
boolean b2= false;
Result r1 = null;
Result r2 = null;
callback1(
done(Result r){
b1 = true;
r1 = r;
asyncTwoFunction(b1,b2)
}
)
callback2(
done(Result r){
b2 = true;
r2 = r;
asyncTwoFunction(b1,b2)
}
)
asyncTwoFunction(b1,b2){
if(b1 && b2){
doSomeThing(r1,r2);
b1 = false;
b2 = false;
}
}
Are there some better way to do this? Thanks