The only way I can find that this is possible is if both AsyncTasks' onPostExecute() executed SO simultaneously that they were virtually running the same lines at the same time, since I set the 'itemXdownloaded' flag to true right before I check for both and call startActivity().
Since they are both called on the main application thread, that's not possible, unless you're doing something really strange.
I would introduce some Log
calls to ensure that you are not misreading the symptoms.
Beyond that, it is difficult to see any problems from your pseudocode, unless there's a possibility of other downloadID
values beyond the three shown. For example, if there is a DL4
, and DL4
completed after DL1
and DL2
, DL4
would trigger your activity.