问题
I have this app that onResume() creates five fragments. Each fragment then opens a http connection to download an XML file. This is done using an AsyncTask. In the async tasks onPostExecute() the XML file is processed and the result rendered in a tab.
I'm trying to figure out how to display a "Loading..." screen that is removed when the last fragments XML file is processed.
I've looked at onPreExecute() to setup a ProgressDialog but I only want to do it once...
I could create a counter that was incremented when my fragment was created and... decremented(?) when the XML processing completes and then just wait for it to reach zero. But that's not really very elegant. Also I would like to make it "future proof" so that I don't have to change the code when I add tab #6.
Please help...
来源:https://stackoverflow.com/questions/25608795/android-how-to-detect-when-multiple-http-requests-complete