Same Activity called twice... Issue with Multiple AsyncTasks?
        Posted  
        
            by stormin986
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by stormin986
        
        
        
        Published on 2010-05-08T23:06:54Z
        Indexed on 
            2010/05/10
            7:14 UTC
        
        
        Read the original article
        Hit count: 301
        
I have three simultaneous instances of an AsyncTask for download three files. When two particular ones finish, at the end of onPostExecute() I check a flag set by each, and if both are true, I call startActivity() for the next Activity.
I am currently seeing the activity called twice, or something that resembles this type of behavior. Since the screen does that 'swipe left' kind of transition to the next activity, it sometimes does it twice (and when I hit back, it goes back to the same activity). It's obvious two versions of the activity that SHOULD only get called once are being put on the Activity stack.
Could this be from both onPostExecute()s executing simultaneously and both checking the flags each other set at the exact same time? This seems extremely unlikely since two processes would have to be running line-by-line in parallel...
*EDIT* A lot removed from this question since I was way off in what I thought was wrong. Nonetheless I found the answer here quite useful, so I have edited the question to reflect the useful parts.
© Stack Overflow or respective owner