android - Wait for completion of AsyncTask and Loading of Map -


i writing code takes input 1 asynctask(httpurlconnection) start asynctask(httpurlconnection) uses information add markers google map.

the problem facing map has not loaded @ time when try add markers through onpostexecute. when try use onmapready data has not yet been downloaded.

is there way can wait both data load , map ready before attempting place markers?

synce question generic , provided no custom code, post "generic solution":

boolean isstep1done = false; boolean isstep2done = false;  private class exampleoperation extends asynctask<string, void, string> {      @override     protected string doinbackground(string... params) {         thread.sleep(1000);         return "completed";     }      @override     protected void onpostexecute(string result) {         isstep1done = true;         continuelogic();     }      @override     protected void onpreexecute() {}      @override     protected void onprogressupdate(void... values) {} } 

same thing exampleoperation 2, sets isstep2done true. then, if sequential, can continue, if independant, on each call continuelogic(), , first step in function, check flags.

private void continuelogic(){    if(isstep1done && isstep2done ){       stuffs...    } }  

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -